Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing Git For Windows #27

Open
ElectricRCAircraftGuy opened this issue Oct 18, 2023 · 2 comments
Open

Installing Git For Windows #27

ElectricRCAircraftGuy opened this issue Oct 18, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@ElectricRCAircraftGuy
Copy link
Owner

ElectricRCAircraftGuy commented Oct 18, 2023

Installing Git For Windows

When installing Git For Windows, which also has Git Bash, be sure to check the box for (NEW!) Add a Git Bash Profile to Windows Terminal, as shown in blue here in the Git 2.42.0 setup:

Screenshot from 2023-08-21 22-48-27

Choose Sublime Text as your git editor (Sublime Text should have already been installed).

Override the branch name, and set it to main:

image

For line endings, I prefer to use Unix style line endings (LF), instead of Windows style (CRLF), even on Windows. So, choose the core.autocrlf = input option, as shown here:

image

Check the box to enable symbolic links:

image

Check these two boxes too:

image

Fix the ~ (HOME) dir in Git Bash, if necessary

Update: see my new answer here to solve this problem: Change the location of the ~ directory in a Windows install of Git Bash

My original notes:

I've noticed, and I don't know why, that sometimes Git Bash sets your HOME (~) directory to /u/, which is super weird, instead of to /c/Users/myusername. To check this, run echo ~ or echo "$HOME" (same thing). If you see /u/, that's not right. You should see something like /c/Users/myusername instead. The first / in an absolute path in Linux or in Git Bash represents the filesystem root, just like C:\ does in Windows.

  1. So, if your HOME dir is not right, open up the profile file in your Git Bash root folder in a text editor. It is located at C:\Users\myusername\AppData\Local\Programs\Git\etc\profile, for example. If you have MS VSCode installed, you can open this file for editing in VSCode by running the following in Git Bash:

    # open this file for editing in VSCode
    code /c/Users/$USERNAME/AppData/Local/Programs/Git/etc/profile

    Add the following to the very top of this file. Be sure to use Linux-style forward slashes (/), not Windows-style backslashes (\), in the path. Note that "GS" here is just my initials, so I can be reminded that I made this change and added this comment:

    # GS: Manually fix the HOME dir
    HOME="/c/Users/$USERNAME"

    Save and close the file when done.

  2. Close and re-open any Git Bash terminals you have open, to finalize this change.

  3. Run echo ~ or echo "$HOME" again to verify that the home folder is now set correctly, and now shows /c/Users/myusername.

Also do this

  1. My answer: Stack Overflow: Python doesn't work in Git Bash (it just hangs or freezes forever); and getting Linux hash-bangs to work in Windows

See also

  1. My answer: Stack Overflow: Adding Git-Bash to the new Windows Terminal
  2. My answer: Stack Overflow: Installing & setting up MSYS2 from scratch, including adding all 7 profiles to Windows Terminal
@ElectricRCAircraftGuy ElectricRCAircraftGuy added the documentation Improvements or additions to documentation label Oct 18, 2023
@ElectricRCAircraftGuy
Copy link
Owner Author

I just referenced my instructions above in my new answer here too: Adding Git-Bash to the new Windows Terminal.

@ElectricRCAircraftGuy
Copy link
Owner Author

ElectricRCAircraftGuy commented Nov 2, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant