Contents
Terminology
- Authentication: "supply or confirm credentials that are unique to you to prove that you are exactly who you declare to be"
- Authorization: determine what a user is allowed to access or do.
Basic respository access from command line
- SSH remotes: autheticate with GitHub CLI or setup an SSH public/private keypair
- To setup an SSH public/private keypair (see ssh.md for more details):
- Generate keypair:
ssh-keygen -t ed25519 -C <GitHub email>- This produces 2 files:
id_ed25519andid_ed25519.pub
- This produces 2 files:
- Add the public key in
id_ed25519.pubto your GitHub account.
- Generate keypair:
- To setup an SSH public/private keypair (see ssh.md for more details):
- HTTPS remotes: authenticate with GitHub CLI, use a credential helper like Git Credential Manager, or use a personal access token
- How does the Git Credential Manager work, if it does not use a personal access token?
References and resources
Configuration scopes and files [docs]
- system:
$(prefix)/etc/gitconfig$(prefix)refers to where git is installed. For example,%(prefix)/bin/refers to the directory in which the Git executable itself lives. Therefore, if git is installed at/usr/bin/git, then$(prefix)is/usr.- This is set during compilation. See the INSTALL file: https://github.com/git/git/blob/master/INSTALL.
- global (user-specific):
$XDG_CONFIG_HOME/git/configand~/.gitconfig-
When the
XDG_CONFIG_HOMEenvironment variable is not set or empty,$HOME/.config/is used as$XDG_CONFIG_HOME... If both files exist, both files are read in the order given above.
-
- local (respository-specific):
$GIT_DIR/config$GIT_DIRrefers to the.gitfolder
- worktree:
$GIT_DIR/config.worktree-
only searched when extensions.worktreeConfig is present in $GIT_DIR/config
-
- command:
GIT_CONFIG_{COUNT,KEY,VALUE}environment variables and the-coption
Show configurations by scope: git config --list --show-scope
- On macOS, running
git gcyields an error messagewarning: unable to unlink '.git/objects/07/f47bd76ded355e641fd0367026047da28ef3d5': Operation not permitted- Problem: the git object files may have the user immutable flag
uchgset, which can be shown by usingls -l -O <file>on macOS. - Solution: Run the following command to unset the
uchgflag on the files that git gc is attempting to remove, then rerungit gc.git gc 2>&1 1> /dev/null | grep -F 'warning: unable to unlink' | sed -e "s/warning: unable to unlink '//" -e "s/': Operation not permitted//" | xargs chflags -v nouchg
- Problem: the git object files may have the user immutable flag