Linux Server setup

Git setup

The version management software or SCM software (source code management) Git was released in 2005 as open source software. Today, this versioning technique is the standard and it is impossible to imagine software development without it.

If you've worked with Git before but git tree, git object types or git data model don't mean anything to you, I'd like to recommend this Git Internals PDF or this Video (Git Internals - How Git Works). It is very helpful to understand the mechanisms behind Git internals.


Install Git

Git can be downloaded for free from the official website: git-scm.com.

During installation, the preset can be kept and clicked through.

Windows users should check "PATH environment": "Run Git from the Windows Command Prompt". This will allow Git to be used from the Windows command prompt. Unless you want the Git Bash, which is a separate Unix-like console window.


Set up Git

After the installation, Git is ready to use. However, it is not wrong to make a few settings before we start working with Git.

Git has global, i.e. system-wide (--global), but also local (--local) settings that are only valid for a repository (source / archive). The local settings are always used unless the --global parameter is explicitly mentioned. Therefore, the --local parameter can usually just be omitted.

Git global settings

Using a terminal or the Windows command prompt, we can read the global settings with the --list and --global parameters:


git config --list --global
 

Git needs an email address to associate commits with an author. At the latest, Git will ask for it on the first commit anyway. With the --global parameter, we set an address as the system-wide default:


git config --global user.email "tom@linuxservrsetup.com"
 

In the same way a username can be set via user.name:


git config --global user.name "tom"
 

Git local settings

Of course, it can happen that other user data apply to projects. To process the settings of a repository, you must first change to the corresponding directory.

For the local settings, we simply replace --global with --local or just omit the parameter:


git config --list
 

Different email address and username for a repository:


git config user.email "tom@linuxservrsetup.com"
git config user.name "tom"