GitCredentials » History » Revision 2
Revision 1 (Tech-X Corporation, 06/27/2019 05:17 PM) → Revision 2/5 (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 interactively. If you do not cache git credentials in advance of using bilder, 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. repositories. ## ~/.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: <pre> https://username:password@server.com </pre> For ice.txcorp.com, where Tech-X git repos will be stored: <pre> https://username:password@ice.txcorp.com </pre> If you have a github.com account, you may cache your github.com credentials in the same file: <pre> https://username:password@ice.txcorp.com https://github_username:github_password@github.com </pre> Because this is a plain text file containing your password(s), change permissions of the file so only you can read it: <pre> chmod 600 ~/.git-credentials </pre> ## 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 <pre> git config --global credential.helper 'store --file=~/.git-credentials' </pre> This command adds lines to ~/.gitconfig: <pre> [credential] helper = store --file=~/.git-credentials </pre> ## Configure git to check ~/.git-credentials for a specific clone or master cd to the clone and execute <pre> git config credential.helper 'store --file=~/.git-credentials' </pre> This command modifies the file: <pre> {clone}/.git/config </pre> ## 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: <pre> security find-internet-password -s github.com </pre> The result of this command will be * 0 - server credential found in keychain * 44 - server credential not found in keychain