Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Git Config(s)

System level

Aapplied to every user on the system and all their repositories.

Global User level

Specific personally to you, the user.

Repository level

Specific to that single repository.

Set repo-specific (non-global) config settings:

git config user.name "Alex Sokolsky"
git config user.email "asokolsky@gmail.com"
git config core.sshCommand "ssh -i ~/.ssh/private_key"

Make sure your private identity is available:

ssh-add ~/.ssh/private_key

Then

git remote add origin git@github.com:asokolsky/repo.git
git push --set-upstream origin master

View All Settings

Show system, global, and (if inside a repository) local configs:

git config --list

To also show the origin file of each config item:

git config --list --show-origin

To get e.g. user.name:

git config user.name

You may also specify options --system, --global, --local to read that value at a particular level.

Best Practices - Global Config

Followed Customizing Git Configuration.

git config --global user.name "Alex Sokolsky"
git config --global user.email "asokolsky@gmail.com"
git config --global core.editor /usr/bin/emacs
git config --global core.excludesfile ~/.gitignore_global
git config --global core.pager ''
git config --global push.default current

where ~/.gitignore_global:

*~
.*.swp
.DS_Store