Skip to content

Instantly share code, notes, and snippets.

@jai-o
Created October 9, 2012 05:54
Show Gist options
  • Save jai-o/3856878 to your computer and use it in GitHub Desktop.
Save jai-o/3856878 to your computer and use it in GitHub Desktop.
GIT: Config commands

GIT: Config commands

Typical configuration commands

git config --global user.name "Your Name"
git config --global user.email "example@example.com"

git config --global color.ui true

git config --global core.autocrlf input
git config --global core.safecrlf true
git config --global core.excludesfile ~/.gitignore_global
git config --global credential.helper osxkeychain

Generating SSH for Github

ssh-keygen -t rsa -C "example@example.com" cat ~/.ssh/id_rsa.pub | pbcopy // this is to copy to your github account

git config --global github.user username git config --global github.token a1b2c3tokenhere // from your github acct to your mac

# Via: https://help.github.com/articles/ignoring-files
# Also find collection of ignore templates here: https://github.com/github/gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
$git credential-osxkeychain
# Test for the cred helper
# git: 'credential-osxkeychain' is not a git command. See 'git --help'.
$curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
# Download the helper
$chmod u+x git-credential-osxkeychain
# Fix the permissions on the file so it can be run
$sudo mv git-credential-osxkeychain /usr/local/git/bin/
# Move the file so git can access it
# NOTE: the /usr/local/git/bin path may vary based on your OS version or where
# you have installed Git. You can use `which git` to find your path and use
# that if it is different. For example the result of `which git` for the path
# above would be `/usr/local/git/bin/git`
# Password: [enter your password]
$git config --global credential.helper osxkeychain
# Set git to use the osxkeychain credential helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment