New Mac Setup
git -- version
which git
brew install git
git -- version
which git
The latter should output:
/usr/local/bin/git
git config --global user.name "Your Name Here"
and
git config --global user.email "your_email@youremail.com"
This info will get added to your .gitconfig
file.
.gitconfig
file can be edited directly. For example, github username & aliases can be set in the respective categories in the .gitconfig
file:
[user]
name = First Last
email = email@email.com
[github]
user = username
[alias]
a = add
ca = commit -a
cam = commit -am
s = status
pom = push origin master
pog = push origin gh-pages
puom = pull origin master
puog = pull origin gh-pages
cob = checkout -b
[credential]
helper = osxkeychain
With the above aliases, you can run git s
instead of git status
.
git config --global credential.helper osxkeychain
(This might not work if 2FA is enabled (see here in which case SSH is required - see below.)
(N.B. This can already be added by editing the .gitconfig
file directly, as in the example before this point)
** to add info here **
Tell git to ignore .DS_Store files (Mac-specific). To never include .DS_Store files in Git repositories, configure your Git to globally exclude those files:
Set up a .gitignore
file to specify a global exclusion list:
git config --global core.excludesfile ~/.gitignore
# adding .DS_Store to that list
echo .DS_Store >> ~/.gitignore