jon wear's personal website

Simple Git configurations for beginners (like me)

15 February 2014


As the shores of Microsoft disappear over the horizon, I find myself using tools that I used to think of as convoluted command line hacks and black magic. Things like Git. Of course, now that' I've used Git for several months in a for real multi-user multi-location environment, I love it. Not only do I use it, but I'm comfortable enough now that I don't even use the GUI's. I'm all CLI like the real hipster programmers.

I use Git and Github a lot these days. It's cool and all but there were the inevitable hickups along the way. Lots of Googling. Here's a list of things that I wish had been all in one place when I started. I provide this for others(my future self included) who might be new to Git/GIthub and want to lessen the learning curve a bit. These tweaks assume you already have Git installed, a free Github account and an SSH key. If not, create an account at Github and follow these steps to create an SSH key. Moving on...

These are the problems I ran into early on and how they got fixed plus a few tweaks.

Every time I do a git push to a repo on Github, I get asked for username and password.

This is most likely because you did a git clone from HTTPS and not SSH. I'd post a screen shot but the UI will probably change at some point. Look on the github repo page, find the clone URL and make sure that you are copying the one for SSH. More Info.

I make changes on my local branch, but when I push to Github it says, "Everything is up to date" even though it's not.

Instead of doing git push, do

git push origin <branch name>

as in:

git push origin newfeature

More info

I get asked for a pass phrase every time I do a push or pull.

On the command line type: - eval $(ssh-agent) <enter> - ssh-add <enter>

Helpful git aliases

You can run these at the command line to make typing git commands a little easier.

  • $ git config --global checkout
  • $ git config --global branch
  • $ git config --global commit
  • $ git config --global status

git commit becomes git ci. git checkout becomes git co and git branch becomes git br. (These aliases were taken from Scott Charon's book Pro Git).


It's nice to have some color on the command line. Set this so that the git diff, git status and other commands return some color variation to make things easier to read.

  • $ git config --global color.ui true
  • More Info

One more thing

Instead of doing git commit -m 'message' all the time, you can do a git commit -av which will launch the default text editor, let you view the changes that are going into the commit AND type the commit message. I like using Sublime, so updated the git config to do so.

git config --global core.editor "subl -n -w"

More Info

If you see anything wrong, let me know. Present and future me thanks you, but not past me. Past me is a corner cutting jerk.

By Jon Wear