How to git

The github site is really nice for easy commits, there are multiple tools provided to manage that on multiple plateform. (Github Desktop, Kraken). However I wanted to document and explore the command line way of commiting.

Source

My main source will be from gitlab plus some precision over certain steps that I’ve encountered while doing them at a beginner level. But there’s also a very good documentation made by github.

Configure your environment

Windows: Install Git for Windows which is an emulated terminal with git.

Mac: Type git in the Terminal application. If it’s not installed, it will prompt you to install it.

Debian: sudo apt-get install git-all</br> Red Hat: sudo yum install git-all

Configure Git

One-time configuration of the Git client. Replace what’s in " " by your information.

git config --global user.name "Your Name"
git config --global user.email you@example.com

Configure SSH Key

Type on the command prompt cmd.exe (on Windows, not in the git one).

ssh-keygen -t rsa -b 4096 -C "you@computer-name"

You will be prompted for the following information. Press enter to accept the defaults. Defaults appear in parentheses.

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/you/.ssh/id_rsa.
Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
The key fingerprint is:
39:fc:ce:94:f4:09:13:95:64:9a:65:c1:de:05:4d:01 you@computer-name

Then find your rsa key in the repository (by default, from the command prompt on windows):

cat ~/.ssh/id_rsa.pub

Copy it in the right place on Github (https://gitlab.com/profile/keys) or Gitlab (https://github.com/settings/keys) or via commande line (for windows, on the git one, to copy something into the git bash on Windows use insert):

ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com