Reputation: 2844
In order to enable pushing on a github repo, I am supposed to use "Token Authentication".
After creating a token, I am supposed to store this in my local github client. https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git.
How do I make my local github client then interact with my local git? I simply want to use git push
to my github repo and use the stored token to authenticate.
Alternatively, I would ommit the local github client and store the token directly in git, but I did not find out how to achieve that.
Upvotes: 1
Views: 999
Reputation: 115037
Git doesn't have a builtin store for storing credentials, it instead relies on 'credential managers' to store the credentials and feed them back when needed.
The most common credential manager is the Git Credentials Manager (GCM) (formerly gcm-core). It can be configured to store the credentials in your operating systems secure store or to store them encrypted on disk.
curl -LO https://raw.githubusercontent.com/GitCredentialManager/git-credential-manager/main/src/linux/Packaging.Linux/install-from-source.sh &&
sh ./install-from-source.sh &&
git-credential-manager-core configure
Or if you rely on Windows Subsystem for Linux you can have it piggyback on the Windows credential store as well.
In your .gitconfig
add:
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe"
git config --global credential.https://dev.azure.com.useHttpPath true
More details:
Upvotes: 1