Tools and guides for doing software development, data analytics, online privacy, and other things.
Clone with HTTPS.
GIT_USER="3ch01c"
GIT_REPO_NAME="3ch01c.github.io"
GIT_REPO_https://github.com/$GIT_USEGIT_REPO_NAME.git" # https://github.com/3ch01c/3ch01c.github.io.git
git clone $GIT_REPO_URL
Or clone with SSH.
GIT_USER="3ch01c"
GIT_REPO_NAME="3ch01c.github.io"
SSH_USER="git@github.com"
GIT_REPO_URL="$SSH_USER:$GIT_USER/$GIT_REPO_NAME.git" # git@github.com:3ch01c/3ch01c.github.io.git
git clone $GIT_REPO_URL
Add user name/email to the current project.
GIT_USER_NAME="Jack Miner"
GIT_USER_EMAIL="5547581+3ch01c@users.noreply.github.com"
git config user.name $GIT_USER_NAME
git config user.email $GIT_USER_EMAIL
Use GPG signing globally.
git config --global commit.gpgsign true
export
Assign a GPG key for signing commits. If you don’t have a GPG key, here’s how to create one.
GIT_SIGNING_KEY=$($GPG_PROGRAM --list-keys --with-colons $GIT_USER_EMAIL | awk -F: '/^pub:/ { print $5 }')
git config user.signingkey $GIT_SIGNING_KEY
Thanks Jay Patel! Enable credential caching.
git config --global credential.helper store
Specify cache expiration.
git config --global credential.helper 'cache --timeout 7200'
error: gpg failed to sign the data
Ensure the signing key was configured correctly.
git config --get user.signingkey
If the key looks bad, refer to how to sign your commits. If the key looks good, set GPG_TTY
.
export GPG_TTY=$(tty)
If that doesn’t work, try setting the GPG program. Maybe it’s gpg
or maybe it’s gpg2
or maybe it’s something else.
GPG_PROGRAM="gpg"
# GPG_PROGRAM="C:\Program Files (x86)\GnuPG\bin\gpg.exe" # For Windows
git config --global gpg.program $GPG_PROGRAM