Skip to content
Snippets Groups Projects
Unverified Commit 26dbeaac authored by Laurent Modolo's avatar Laurent Modolo
Browse files

tp.md: make https the default for the tp

parent 804030f0
No related branches found
No related tags found
No related merge requests found
...@@ -23,10 +23,12 @@ don't protect them with a password. ...@@ -23,10 +23,12 @@ don't protect them with a password.
But don't stress to much about it, you can always remove the key later from your But don't stress to much about it, you can always remove the key later from your
[gitlab configuration](http://gitlab.biologie.ens-lyon.fr/profile/keys). [gitlab configuration](http://gitlab.biologie.ens-lyon.fr/profile/keys).
Throughout this practical, every string between chevrons `<like this one>` must be replaced with the adequate value.
## Git configuration ## Git configuration
Git can be configured with the `git config` command or directly by editing the 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 ```sh
# This is Git's per-user configuration file. # This is Git's per-user configuration file.
...@@ -53,9 +55,21 @@ pressed. ...@@ -53,9 +55,21 @@ pressed.
## Gitlab connection ## Gitlab connection
There are many ways to connect to a gitlab server. Git relies on other 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 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.
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. ### 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) ### `~/.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: ...@@ -65,13 +79,10 @@ To connect to the gitlab server via ssh, you first need to generate a ssh key:
ssh-keygen -t rsa -C "your.email@ens-lyon.fr" -b 4096 -f ~/.ssh/id_rsa_gitlab_lbmc ssh-keygen -t rsa -C "your.email@ens-lyon.fr" -b 4096 -f ~/.ssh/id_rsa_gitlab_lbmc
``` ```
When you are on a UNIX system and when you have the right to remove the writing 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.
permission to your `~/.ssh/config` for the group and the others, you can use this Otherwise, `ssh` won't let you use this configuration file for security reasons.
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 You need to add the following lines to the file `~/.ssh/config` to use it automatically for connection to `gitlab_lbmc`.
automatically for connection to `gitlab_lbmc`.
```sh ```sh
Host gitlab_lbmc Host gitlab_lbmc
...@@ -82,10 +93,7 @@ Host gitlab_lbmc ...@@ -82,10 +93,7 @@ Host gitlab_lbmc
IdentityFile ~/.ssh/id_rsa_gitlab_lbmc IdentityFile ~/.ssh/id_rsa_gitlab_lbmc
``` ```
This configuration provides you with the shortcut `gitlab_lbmc` to connect 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`.
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` 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: ...@@ -95,19 +103,7 @@ To test your connection run:
ssh -Tv gitlab_lbmc ssh -Tv gitlab_lbmc
``` ```
### the https method (for the PSMN computers) With this second method, you will have to replace every `https://gitlab.biologie.ens-lyon.fr/` url in the sequel with `gitlab_lbmc:`.
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/`
# Part 1: Git alone # Part 1: Git alone
...@@ -124,7 +120,7 @@ The `git clone <url>` command retrieves the whole history of a project and setup ...@@ -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. working area based on the last point in this history.
```sh ```sh
git clone gitlab_lbmc:LBMC/file_handle.git git_basis_tp1 git clone https://gitlab.biologie.ens-lyon.fr/LBMC/file_handle.git git_basis_tp1
git -c http.sslVerify=false clone https://lmodolo@gitlab.biologie.ens-lyon.fr/LBMC/file_handle.git git_basis_tp1 git -c http.sslVerify=false clone https://lmodolo@gitlab.biologie.ens-lyon.fr/LBMC/file_handle.git git_basis_tp1
cd git_basis_tp1 cd git_basis_tp1
ls -l ls -l
...@@ -268,7 +264,7 @@ We can check the current remote addresses of our local git repository: ...@@ -268,7 +264,7 @@ We can check the current remote addresses of our local git repository:
git remote -v git remote -v
``` ```
**origin** is set to `gitlab_lbmc:LBMC/file_handle.git` for `fetch` and `push` **origin** is set to `https://gitlab.biologie.ens-lyon.fr/LBMC/file_handle.git` for `fetch` and `push`
operation. operation.
We want to add our repository to the remote addresses of our local git repository. We want to add our repository to the remote addresses of our local git repository.
...@@ -277,7 +273,7 @@ to match the ssh configuration file and use our ssh key in the connections to ...@@ -277,7 +273,7 @@ to match the ssh configuration file and use our ssh key in the connections to
this server. this server.
```sh ```sh
git remote add perso gitlab_lbmc:<user_name>/git_basis.git git remote add perso https://gitlab.biologie.ens-lyon.fr/<user_name>/git_basis.git
git remote add perso https://gitlab.biologie.ens-lyon.fr/<user_name>/git_basis.git git remote add perso https://gitlab.biologie.ens-lyon.fr/<user_name>/git_basis.git
git remote -v git remote -v
``` ```
...@@ -334,7 +330,7 @@ given branch of your repository while keeping others under your control. ...@@ -334,7 +330,7 @@ given branch of your repository while keeping others under your control.
Clone **W**’s repository: Clone **W**’s repository:
```sh ```sh
git clone gitlab_lbmc:<W_name>/git_basis.git git_basis_tp2 git clone https://gitlab.biologie.ens-lyon.fr/<W_name>/git_basis.git git_basis_tp2
git clone -c http.sslVerify=false https://gitlab.biologie.ens-lyon.fr/<W_name>/git_basis.git git_basis_tp2 git clone -c http.sslVerify=false https://gitlab.biologie.ens-lyon.fr/<W_name>/git_basis.git git_basis_tp2
cd git_basis_tp2 cd git_basis_tp2
git remote -v git remote -v
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment