Git is a version control system very popular amongst developers. After installing Homebrew, installing git is a very simple task:
brew update
brew install git
After the installation is complete, run brew doctor
. Check Homebrew warnings section if homebrew displays any warnings / errors.
In order to check git installation, run git --version
.
Running which git
should output /usr/local/bin/git
.
Next we will set your Github user and email for git.
If you do have a Github account, create one. Add your user name and email in git using:
$ git config --global user.name "Your Github Full Name"
$ git config --global user.email "Your Github Email Address"
git config --global push.default matching
These options will be added into the ~/.gitconfig
file. You can check the contents of this file using vim ~/.gitconfig
command.
The official Git setup guide recommends the HTTPS method (over SSH). In order to set HTTPS connection, we will enable using Git password caching (article):
git config --global credential.helper osxkeychain
curl -s -O \
https://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
.chmod u+x git-credential-osxkeychain
sudo mv git-credential-osxkeychain \
"$(dirname $(which git))/git-credential-osxkeychain"
git config --global credential.helper osxkeychain
The next time you clone an HTTPS URL that requires a password, you'll be prompted for your username and password, and to grant access to the OSX keychain. After you've done this, the username and password are stored in your keychain and you won't be required to type them in to Git again.
Remember to always add .DS_Store
(a hidden OSX system file added to all folders) to the .gitignore
file for all git projects.
Download the Github app and open it. follow the on-screen instructions to set it up. This will create a SSH key in your Github account. This will be used by the app to communicate with your account. A paid alternative is Tower.
Although a GUI git client has it's advantages, consider using the command line for the majority of your git-related tasks.
The majority of your projects will ignore certain files. Use this gitignore example to add default ignore files.
Next we will set OSX Terminal to show the git branch and state.
https://gist.github.com/mihaiionescu/0545d1b52ab5be540bd1
-- TO BE ADDED --