Git best practices & FAQ

Mis à jour il y a environ 2 ans

Can I have my project's git repository hosted by the IT department?

Yes, there already are projects here: https://gitlab.pasteur.fr/.
Please always sign in with your Pasteur account or else you won't be able to create new repositories.
Once you log in with a GitHub or a Google account, you become an external user and lose your project management privileges.
Then you have to contact to ask an Administrator to change your status.

Can I have a "personal" git repo in my home directory on atlas?

Yes.

What is the maximum size for a git repository?

Officially, there is no maximum size but when repositories become too big, problems arise.
A reasonable size for a git repository is approx 1GB.

Are there files that I should avoid putting in a git repository?

Yes
  • data files,
  • binary files,
  • files bigger than 1 MB

should not be put in a git repository.

So where can I put data files?

  • In your home directory if you are the only person who need access to it.
  • In a project space if other persons need access to it.

How can I get a project space?

Send an email to

Why do big files cause problems in git?

Because git makes all its file comparisons in memory. So you are likely to have problems since memory is limited on machines.

Why shouldn't I issue git commands on ssh.pasteur.fr?

Because it may require a lot of memory if you have big files and that may crash the machine. Remember that that machine is used by many people.

So, how can I clone and do any operation on the git repository that is in my HOME?

Mount your home on your personal computer or workstation and access it as if it was located on your machine.

git clone path_to_mounted_home_on_my_machine/my_git_repo.git my_local_repo

Example on OS X:

git clone  /Volumes/\@home/path/to/the/git/repo/my_git_repo.git   my_local_repo

You can also use git over ssh (if your repo is of reasonnable size): git clone yourlogin@remote/path/to/the/git/repo
Example:

git clone yourlogin@ssh.pasteur.fr:/path/to/the/git/repo/  my_local_repo

Warning: regarding the Pasteur GitLab, you have to create an ssh key before being able to clone a repository. Once done, you can do

git clone git@gitlab.pasteur.fr:yourlogin/your_repo.git   my_local_repo

How to mount my home directory?

From Windows and OS X, machines with the Pasteur homemade master should already have a shortcut to @home. If not, send an email to

On Linux, have a look at https://projets.pasteur.fr/projects/linux-pasteur/wiki

How to avoid commiting certain types of files?

You can use a .gitignore file. Do some google search to see how. It is explained at many places. For example: https://github.com/github/gitignore

I made a mistake and pushed a big data file to my git repo; what can I do?

The problem is that even if you remove the file, it will stay in git history. So the repository will remain big.
You can either:
  • (easiest way) create a new git repository where you will put only the necessary files and not the big one,
  • rewrite history. You can use the BFG Repo-Cleaner . Other people using the repo will have to git clone it again if you do that.