GitCredentials » History » Revision 2
« Previous |
Revision 2/5
(diff)
| Next »
Tech-X Corporation, 06/27/2019 05:19 PM
Git Credentials¶
Private git repos require a username and password to clone and to push.
In the near future, bilder may require access to private git repos.
This document details how to cache your git credential so that you do not have to enter them interactively, and so that bilder will not fail to clone required git repositores.
You should store your git credentials as soon as possible on all machines where you expect to run bilder.
~/.git-credentials on Windows, Linux and Mac¶
The location of your credentials is the same for Windows, Linux and Mac. It is the file ~/.git-credentials. ~ is your login or home directory. bilder will check for the existence of this file.
On all of the above platforms where you expect to run bilder, create the file ~/.git-credentials with one line for each server:
https://username:password@server.com
For ice.txcorp.com, where Tech-X git repos will be stored:
https://username:password@ice.txcorp.com
If you have a github.com account, you may cache your github.com credentials in the same file:
https://username:password@ice.txcorp.com
https://github_username:github_password@github.com
Because this is a plain text file containing your password(s), change permissions of the file so only you can read it:
chmod 600 ~/.git-credentials
Configure git to check ~/.git-credentials¶
git may be configured to check ~/.git-credentials for all repos (--global), or for a single git repo.
To configure git globally, execute the following command in a
- Windows - cygwin window
- Linux - terminal
- Mac - terminal
git config --global credential.helper 'store --file=~/.git-credentials'
This command adds lines to ~/.gitconfig:
[credential]
helper = store --file=~/.git-credentials
Configure git to check ~/.git-credentials for a specific clone or master¶
cd to the clone and execute
git config credential.helper 'store --file=~/.git-credentials'
This command modifies the file:
{clone}/.git/config
Mac Keychain¶
The default credential.helper for Mac OS X is Keychain application. git refers to this as osxkeychain.
If you are using bilder on a Mac, git will check for credentials in osxkeychain.
If you have additionally configured git to check ~/.git-credentials, it will check for the server credentials in that file.
Checking for server credentials in Keychain¶
You may check on the command line for the existence of a stored credential in Keychain:
security find-internet-password -s github.com
The result of this command will be
- 0 - server credential found in keychain
- 44 - server credential not found in keychain
Updated by Tech-X Corporation over 5 years ago · 2 revisions