In order to run git on a Windows Subsystem for Linux (WSL) distribution, git must be explicitly installed on the distribution. This installation differs from git installed on the host, Windows machine. This post documents the steps required to install and run git on a WSL distribution.
1. Install the git application using sudo apt install git
Once the password for the account with administrative privileges has been entered, git will be installed:
2. Us git config to assign user.name and user.email (obviously use your own name and email address):
git config --global user.name "Jan David Narkiewicz"
git config --global user.email "jdnark@softwarepronto.com"
An example of git config invoked to configure name and email is as follows and note that there is no output returned by git config:
- for HTTP-enabled Git repositories provides support for single-factor authentication
- for ADO (Azure DevOps), Bitbucket, and GitHub support for multi-factor authentication
Git Credential Manager is installed using git config as follows:
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe"
An example of git config invoked to configure credential.helper is as follows and note that there is no output returned by git config:
4. Using git with Azure repositories requires the following additional command to be invoked on the terminal for the target WSL distribution:
git config --global credential.https://dev.azure.com.useHttpPath true
Once step 3 is completed or when steps 3 and 4 are completed, GCM will manage the credentials git uses so that they do not need to be entered for each git command. To quote Microsoft' excellent write up on setting up Git for WSL (Get started using Git on Windows Subsystem for Linux):
Example of Git Credential Manager
An example of a git command is being invoked (git clone) is as follows:
Closing the Git Credential Manager dialog will fall back on prompting the user for their credentials in the terminal console of the distribution:
Once valid credentials are entered, they will be stored by Git Credential Manager and future git commands will not prompt for credentials.
Once the credentials are entered on the WSL distribution, GCM is a bridge to Windows Credential Manager on the Windows host. See Windows Credential Manager where a credential exists for softwarepronto.visualstudio.com:
Appendix A: Git Credential Manager
The readme file for Git Credntial Manager can be found on github.com at Readme.md: Git Credential Manager.
No comments :
Post a Comment