This document is particularly important if you follow the Rstudio or the Org-Mode course. If you follow the Jupyter course, it can be ignored in a first step as we have closely integrated Jupyter and GitLab in the context of this MOOC.
So far, you only used git via the web interface from the GitLab we deployed for the MOOC.
If you access this link from the FUN platform, you do not have to authenticate and you can readily read and modify all your files. This is very convenient but in most cases, you will want to have your own local copy of the repository and you will have to synchronize your local copy with the remote GitLab one. To propagate your modifications, you will obviously have to authenticate yourself on GitLab.
This document describes the software you need to have installed on your machine and how to handle authentication. The "Configuring Git" section is illustrated in a video tutorial (in French).
Please read all these instructions carefully, in particular the one on "Configuring your password on GitLab".
We provide here only instructions for debian-based distributions. Feel free to contribute to this document to provide up-to-date information for other distributions (e.g., redhat, fedora).
Run (as root):
apt-get update ; apt-get install git
Apparently, this works with GitLab and https.
Set a Git username and email:
git config --global user.name "Mona Lisa" git config --global user.email "email@example.com"
Confirm that you have set the Git username correctly:
git config --global user.name git config --global user.email
Mona Lisa email@example.com
You may be behind a proxy, in which case you may have trouble cloning
or fetching from a remote repository or you may get an error like
unable to access '...' Couldn't resolve host '...'
.
In such case, consider something like this:
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
The proxyPassword will be stored unencrypted in your .gitconfig
file,
which you may not want. In that case, remove it from the URL and you
will be prompted for it every time it is needed.
Access GitLab. Note: You have to access Gitlab from the FUN platform otherwise you may get a 405 error when trying to direcly open https://app-learninglab.inria.fr/gitlab/users/sign_in.
Click on Sign in:
The long and uggly character sequence, which is here replaced by xxx
is your GitLab login/id. You'll need to use it when trying to
propagate some modifications from your computer to GitLab.
To defind your password, you should go in settings
:
Then, go to the profile
tab to define a valid email address:
You will then receive a email with a link to open to confirm your email address is correct. Just open it.
Once your email address is validated, it will appear as verified
and
as your main address
in the Emails
tab:
You will then finally be able to click on the I forgot my password
button from the password
tab:
You will then receive an email allowing you to reset your GitLab password.
If you clone your repos by simply pasting the GitLab URL, you will be prompted for your login and your password every time you want to propagate your local modifications, which is tedious. This is why you should ask git to remember your login and password as follows
git config --global credential.helper cache # remember my password git config --global credential.helper "cache --timeout=3600" # for one hour at most
With this setup, you will be prompted for your password but it will be cached in memory and they will not be asked again before an hour. You may want to read these instructions to better understand how all this works.
There are two ways of authenticating and synchronizing your local repository with GitLab: through HTTPS or through SSH. The first one is what was just described and does not require any particular software installation on your machine so this is what I recommend for this MOOC. Yet, I like the second one better (although is may seem a bit more technical), which is why I describe it here. It consists in installing SSH, creating a pair or private/public keys, and uploading your SSH public key on GitLab. This section provides with information on how to do this.
We provide here only instructions for debian-based distributions. Feel free to contribute to this document to provide up-to-date information for other distributions (e.g., redhat, fedora).
Run (as root):
apt-get update ; apt-get install openssh-client
You do not have anything to do as it is installed by default.
You should install the Putty client. Once it is installed, look for the section on generating an SSH key.
Here are all the official explanations on how to set up your SSH key on GitLab. Alternatively, you may also want to have a look at this video: