Back

Git Config In 60 Seconds

If you read "Git: Your First Repo" and found some issues committing your first repo, that could be because I left out something important. I apologize for this oversight, and I will hopefully correct it with this article.

As you can see from the title of this article, the important thing I left out was configuring your Git. While I assumed that you were able to install git, I failed to include two important git settings that you must have configured in order to use the git commit command.

Now, git config can be global or local which just means for all your git repos (global) or for each repo (local). We're going to set your user.name and user.email at the global level. Of course, if you have a need to change this for an individual repo, the good news is that setting it local to that repo will override the global setting.

Here goes:
git config --global user.name "<Your Name>"
git config --global user.email <your@email.com>
That's it. This sets your global config user.name and user.email.

To do this for an individual repo, start by going into the directory of that repo and then:
git config --local user.name "<Your Name>"
git config --local user.email <your@email.com>
That will set you up with a username and email for that specific repo.

I really hope this helps. The next step in this process is to connect your repo to an external repository like GitHub. There are many benefits to contributing code to shared repos and private repos. In the case of shared repos, you can build a portfolio of code which can be used to share your talent with recruiters and hiring managers. For private repos, the benefits of offsite storage are more in line with worst case scenarios regarding your hardware.