Throughout this practical, every string between chevrons `<like this one>` must be replaced with the adequate value.
## Git configuration
Git can be configured with the `git config` command or directly by editing the
`~.gitconfig` file. Here is a config example to start:
`~/.gitconfig` file. Here is a config example to start:
```sh
# This is Git's per-user configuration file.
...
...
@@ -53,9 +55,21 @@ pressed.
## Gitlab connection
There are many ways to connect to a gitlab server. Git relies on other
system protocols to handle rights. In the course we have seen Git
interaction through the local file system, thus relying on the user right to
read and write on it but you can also setup an http identification system.
system protocols to handle authentication and rights. Here we are going to use two different method depending if you are using your laptop or a PSMN computer.
### https method (for the PSMN computers)
When you cannot modify the `~/.ssh/config` or set its right correctly, to use git over ssh you can use the https protocol instead of ssh.
As the gitlab server is not accessible outside of the ENS, you will have SSL certificate problem. We can safely ignore them in this TP with the git option `-c http.sslVerify=false`.
You can set this option globally with the command:
```sh
git config --global http.sslVerify false
```
For this method to work, you need to setup a password in you gitlab profile.
Go to [https://gitlab.biologie.ens-lyon.fr/profile/password/edit](https://gitlab.biologie.ens-lyon.fr/profile/password/edit) and set your password.
### `~/.ssh/config` file method (not for PSMN computers)
...
...
@@ -65,13 +79,10 @@ To connect to the gitlab server via ssh, you first need to generate a ssh key:
When you are on a UNIX system and when you have the right to remove the writing
permission to your `~/.ssh/config` for the group and the others, you can use this
method. Otherwise, `ssh` won't let you use this configuration file for security
reasons.
When you are on a UNIX system and when you have the right to remove the writing permission to your `~/.ssh/config` for the group and the others, you can use this method.
Otherwise, `ssh` won't let you use this configuration file for security reasons.
You need to add the following lines to the file `~/.ssh/config` to use it
automatically for connection to `gitlab_lbmc`.
You need to add the following lines to the file `~/.ssh/config` to use it automatically for connection to `gitlab_lbmc`.
```sh
Host gitlab_lbmc
...
...
@@ -82,10 +93,7 @@ Host gitlab_lbmc
IdentityFile ~/.ssh/id_rsa_gitlab_lbmc
```
This configuration provides you with the shortcut `gitlab_lbmc` to connect
yourself to the `gitlab.biologie.ens-lyon.fr` server on the port `2222` under
the `git` user, without using a password and using the identity key
` ~/.ssh/id_rsa_gitlab_lbmc`.
This configuration provides you with the shortcut `gitlab_lbmc` to connect yourself to the `gitlab.biologie.ens-lyon.fr` server on the port `2222` under the `git` user, without using a password and using the identity key ` ~/.ssh/id_rsa_gitlab_lbmc`.
Finally, go to [http://gitlab.biologie.ens-lyon.fr/profile/keys](http://gitlab.biologie.ens-lyon.fr/profile/keys) and paste the content of the file ``~/.ssh/id_rsa_gitlab_lbmc.pub`
...
...
@@ -95,19 +103,7 @@ To test your connection run:
ssh -Tv gitlab_lbmc
```
### the https method (for the PSMN computers)
When you cannot modify the `~/.ssh/config` you can use the https protocol
instead of ssh. As the gitlab server is not accessible outside of the ENS,
you will have SSL certificate problem. We can safely ignore them in this TP
with the git option `-c http.sslVerify=false`.
For this method to work, you need to setup a password in you gitlab profile.
Go to `https://gitlab.biologie.ens-lyon.fr/profile/password/edit` and set
your password.
With this second method, you will have to replace every `gitlab_lbmc:` url in the
sequel with `https://gitlab.biologie.ens-lyon.fr/`
With this second method, you will have to replace every `https://gitlab.biologie.ens-lyon.fr/` url in the sequel with `gitlab_lbmc:`.
# Part 1: Git alone
...
...
@@ -124,7 +120,7 @@ The `git clone <url>` command retrieves the whole history of a project and setup
working area based on the last point in this history.