⪼ Made with 💜 by Polyglot.
- ..
- :: aliases
- :: Bisect
- :: Conflict Resolution
- :: Course
- :: Extensions
- :: git.io
- :: Guides
- :: Internals
- :: Hooks
- :: Managed Hosting Platform
- :: Personal Git Configuration
- :: Project Scaffolding
- :: Talks
- :: Workflows
git log --stat
> git remote set-url --add --push origin git://original/repo.git
> git remote set-url --add --push origin git://another/repo.git
If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
$ eval "$(ssh-agent -s)"
> Agent pid 59566
env GIT_SSH_COMMAND='ssh -i ~/.ssh/repo.pem' git clone [email protected]:ORG/repo.git
> git fetch && git checkout feature/...
> git credential <fill|approve|reject>
[credential "https://gist.github.com"]
helper = 12-factor GIST_GITHUB_API_TOKEN
username = token
#!/bin/sh
logger -is -p local3.info -t $0 "(\$1) $1 [env] (\$2) $2 [action]"
# respond only to `get` action (this environment-based helper is read-only)
if [ "$2" = "get" ]; then
echo "password=${!1}"
exit 0
else
logger -is -p local3.info -t $0 "action not supported ($2)"
exit 1
fi
NOTE: open Console.app
to view logs and search for git-credential-gist
Credential helpers are programs executed by Git to
fetch
orsave
credentials from and to long-term storage (ideally, encrypted at rest).
- git credential helper for GitHub http URLs #676
- github/hub: elyscape commented on Dec 22, 2016
- Custom git credential helper
- AVOIDING REPETITION
- 7.14 Git Tools - Credential Storage
- Custom Helpers
- I created shell alias for hub that reads token from keychain and provides it as a env variable for hub command
- I ended up here while trying to determine if hub supported loading credentials from a ~/.netrc file
git-credential-store
- Helper to store credentials on disk
git config credential.helper 'store [<options>]'
git \
-c credential.helper="!f(){ printf 'username=%s\npassword=%s\n' "$USERNAME" "$PASSWORD" };f" \
push origin master
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
The Git Credential Manager for Windows (GCM) is a credential helper that stores credentials in the Windows Credential Manager.
git
needs to work with a remote host over the HTTPS protocol and invokesgit-remote-https
.git-remote-https
negotiates with the host.- The host rejects
git-remote-https
due to lack of credentials. git-remote-https
fails with a reason code linked to credentials.git
invokesgit-credential
in hopes of acquiring useful credentials.git-credential
scans Git's configuration to see if any helpers are registered.git-credential
invokes the helpers one at a time in the order listed in hopes of one having useful credentials for the + values.git-credential
finds thatcredential.helper=manager
and invokesgit-credential-manager
with the "get" option.git-credential-manaer
lacks credentials for the remote.git-credential-manager
looks at the configuration to determine if these are basic credentials, Visual Studio Team Services, or GitHub; if the request is multi-factor authentication; etc.- In the case of basic credentials,
git-credential-manager
tellsgit-credential
the truth that it does not have any credentials for it. git-credential
then prompts the user at the command line for credentials.- The user enters credentials.
git-credential
invokesgit-credential-manager
with the "store" option and supplies the credentials for storage.