Git in Azure Cloud Shell

Date posted: Post reading time: 1 minute or less

How to login to Git on Azure Cloud Shell.


Advanced Mode (git-credential-manager for linux)

First you need to download and “install” the git-credential-manager for linux. Here are the steps you need to do that:

cd ~
mkdir git/.git-credential-manager/
cd git/.git-credential-manager/
wget "https://github.com/microsoft/Git-Credential-Manager-for-Mac-and-Linux/releases/download/git-credential-manager-2.0.4/git-credential-manager-2.0.4.jar"
ln -s git-credential-manager-2.0.4.jar git-credential-manager.jar
cd ~
nano .gitconfig

Now edit the .gitconfig file to include:

[credential]
	helper = !java -Ddebug=false -Djava.net.useSystemProxies=true -jar ~/git/.git-credential-manager/git-credential-manager.jar
[credential "microsoft.visualstudio.com"]
	authority = MSA
	validate = true
[credential "dev.azure.com"]
	authority = MSA
	validate = true

You should now get a device authenticaion prompt the first time you connect.


Simple mode

You can switch the git credential helper into store mode, now git will save your credentials.

git config credential.helper store