-
Notifications
You must be signed in to change notification settings - Fork 3
Recommended git Usage in WSL2
To prevent constantly entering git credentials, you should install the latest 64-bit version of git for Windows: https://github.com/git-for-windows/git/releases/tag/v2.41.0.windows.1 Default options are fine. Though, there may be edge cases where choosing the non-default option of having windows manage certificates will be less of a headache because UAB HSIS issues custom certificates.
Git should already be installed in WSL Ubuntu (by default). If not, you can install it with
sudo apt-get install git
You will want to use the Windows git credential manager even in WSL so that you do not have to repeatedly enter git credentials.
Once you have confirmed installation of git on both Windows and Ubuntu, run
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe"
You should also take this opportunity to run (and fill in)
git config --global user.name "Your Name"
git config --global user.email "youremail@domain.com"
In each project with a containerized development environment, you will likely need to run these once without the --global flag.
Depending on the repository for the new project, users may have to setup programmatic access to the repository. For example, GitHub requires use of a personal access token to programmatically access repositories. Users can follow the instructions here to setup a personal access token on GitHub and integrate it into their operating system (via Windows Credential Manager, for example.)
