This post isn’t going to explain theoretical concepts behind Git — a version-control system usually managed from the command line, though sometimes managed from a GUI (if we’re Windows programmers, which is me, sometimes). Neither is this a post with in-depth insights or sophisticated actions that can be done in Git and nor is it a post that explains Git and GitHub to non-programmers.
Then what is this? It’s a post in which I gathered basic Git settings that I apply when setting up Git on a new server. This will be my — and hopefully your — one-stop-shop for Git initial configuration definitions.
Let’s start at the beginning — installing Git on a server. Every operating system has its own way of installing Git. Atlassian has a post on its website that lists all the methods for all OSs — Mac, Windows, Linux — and their various flavors. On Centos, which is what’s relevant to me, here is how to install:
sudo yum install git
Every commit is attributed to a specific user. It is recommended that the user’s username and email be set immediately after installation. This is to prevent this message from appearing on the first commit:
Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:
Setting username and password:
git config --global user.name "Your Name"
git config --global user.email you@example.com
If you want to fix the username and password that were used in the commit, you do it using the --amend
parameter:
git commit --amend --author='Your Name <you@example.com>'
Git can paint its commands’ output in beautiful, easy to read colors, instead of just white:
The easiest way to make this happen is by using running this configuration in the command line:
git config --global color.ui auto
If you want to further enhance it, you can read this answer on unix.stackexchange.
#git #git installation #basic definitions #git user definitions