|
|
|
Git is a "version control system". It is used by programmers to keep track of the successive changes in their code (all the versions are stored in a "repository" with a version number). Git also provides a team of programmers with various tools which help them solve problems related to concurrent modifications of the code.
|
|
|
|
Git is a "version control system". It is used by developers to keep track of the successive changes in their code (all the versions are stored in a "repository" with a version number). Git also provides a team of developers with various tools which help them solve problems related to concurrent modifications of the code.
|
|
|
|
|
|
|
|
Git is thus a professional way to share code between developers.
|
|
|
|
|
|
|
|
On the [CECI clusters](http://www.ceci-hpc.be/), a recent version of git is available with the following command
|
|
|
|
```
|
|
|
|
module load git
|
|
|
|
```
|
|
|
|
On Linux, you can install git with the package manager. For example, with Ubuntu:
|
|
|
|
On the [CECI clusters](http://www.ceci-hpc.be/), a recent version of git is available as soon as your are connected to the master node.
|
|
|
|
|
|
|
|
On your own Linux PC, you can install git with the package manager. For example, with Ubuntu:
|
|
|
|
```
|
|
|
|
sudo apt install git
|
|
|
|
```
|
|
|
|
Git will open a text editor when running certain commands such as "git merge" or "git commit". The default editor is [vim](https://www.vim.org/) which is rather difficult to use. If you don't plan to use vim, set the environment variable `EDITOR` to the name of your editor by adding the following line at the end of your `~/.bashrc` file:
|
|
|
|
Git will open a text editor when running certain commands such as `git merge` or `git commit`. The default editor is [vim](https://www.vim.org/) which is rather difficult to use. If you don't plan to use vim, set the environment variable `EDITOR` to the name of your preferred editor by adding the following line at the end of your `~/.bashrc` file:
|
|
|
|
```
|
|
|
|
export EDITOR=XXXX
|
|
|
|
```
|
| ... | ... | @@ -22,11 +20,11 @@ sudo apt install nano |
|
|
|
|
|
|
|
If you work on windows, git is not provided by Microsoft with the OS. You must install it before the next steps.
|
|
|
|
|
|
|
|
## Download git (Windows)
|
|
|
|
## Download git (Windows only)
|
|
|
|
|
|
|
|
Download the latest version of git from the website: https://git-scm.com/
|
|
|
|
|
|
|
|
## Install git (Windows)
|
|
|
|
## Install git (Windows only)
|
|
|
|
|
|
|
|
Double-click on the installer, then follow the instructions. Choose the default options except for the default editor which is configured for "vim" (an old type of editor which is rather difficult to use).
|
|
|
|
|
| ... | ... | @@ -34,20 +32,20 @@ Double-click on the installer, then follow the instructions. Choose the default |
|
|
|
|
|
|
|
Choose one editor that you know well instead of vim (e.g. [NotePad++](https://notepad-plus-plus.org/) on Windows).
|
|
|
|
|
|
|
|
## Configure git
|
|
|
|
## Configure git (Windows/Minux/macOS)
|
|
|
|
|
|
|
|
On Windows, you can use "git" by right-clicking on a folder in the windows explorer and by running "Git Bash Here". Git is also available in any command-line window (Run "cmd", then type "git" in the terminal).
|
|
|
|
On Windows, you can use "git" by right-clicking on a folder in the windows explorer and by running "Git Bash Here". Git is also available in any command-line window (Run "cmd", then type `git` in the terminal).
|
|
|
|
|
|
|
|
On the other systems (Linux/macOS), open a terminal.
|
|
|
|
|
|
|
|
Then, on any system (Windows/linux/macOS), type these commands.
|
|
|
|
Then, on any system (Windows/linux/macOS), type these 2 commands:
|
|
|
|
```
|
|
|
|
git config --global user.name "Your Name"
|
|
|
|
git config --global user.email "your_email@student.uliege.be"
|
|
|
|
```
|
|
|
|
Git must know your name and e-mail address. All your personal work will be identified on GitLab with these 2 strings.
|
|
|
|
|
|
|
|
This configuration step should be done once per computer.
|
|
|
|
This configuration step should be done once per computer, the first time you use git.
|
|
|
|
|
|
|
|
## Configure SSH keys
|
|
|
|
|
| ... | ... | @@ -61,7 +59,7 @@ Then choose "SSH keys" on the menu on the left. |
|
|
|
|
|
|
|
Follow the [procedure](https://gitlab.uliege.be/help/ssh/README#generating-a-new-ssh-key-pair) to create a SSH-key pair (in a "git-bash" terminal on Windows, or a terminal on the other platforms).
|
|
|
|
|
|
|
|
Use the RSA type, which is more compatible with older machines.
|
|
|
|
Use the "RSA" type, which is more compatible with older machines.
|
|
|
|
```
|
|
|
|
$ ssh-keygen -o -t rsa -b 4096 -C "demo"
|
|
|
|
Generating public/private rsa key pair.
|
| ... | ... | |
| ... | ... | |