{ Configuring Git. }


By the end of this chapter, you should be able to:

  • Change global git configuration settings
  • Make temporary and permanent aliases

.gitconfig Settings

If you take a look at git log you may not see any information for the author and email. To change this (you will absolutely want this for GitHub so make sure the email you specify is the same one you used to sign up for GitHub), type:

git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL"

If you also find it annoying to press q every time in git log, you can change this as well

git config --global --replace-all core.pager cat

These global configuration settings live in a file called .gitconfig which typically lives in your home directory. Try running cat ~/.gitconfig to see all of your settings!

Git aliases

Many times you may be finding yourself typing git commands over and over. Things like git add, git init and git status are commands you will be typing many times, so it may be useful to make a shortcut, or alias, which you can type so that you do not need to type the entire command. To create a temporary alias, which will last as long as your terminal session is open, you can type:


So if we wanted to type git st and have that be the same as git status we would type git config alias.st status. Now we can type git st and it should output the same as git status.

If you would like your alias to be a part of your global configuration, add the --global command after git config. For example, to alias git i to git init globally, you would type git config --global alias.i init.

When you're ready, move on to Git Basics Exercises


Creative Commons License