User Tools

Site Tools



Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

It is installed in the cluster so you can use it in your folders. Also there was a training session to learn to use git in your own computer. Check it here

Initial config


Once you have created a GitLab account you have to generate a ssh-key from your computer, but first check if you already have one running this command:

Check ssh-key


$ cat ~/.ssh/ 


 type %userprofile%\.ssh\

If it generates something like this you can skip 'Create a SHH-Key' step and go to 'Copy ssh-key':

 ssh-rsa loooong alphanumeric string

Create a ssh-key:


 $ ssh-keygen -t rsa -C "<user_name>"


 type %userprofile%\.ssh\

Copy ssh-key

And now here is the IMPORTANT thing: Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile. Please copy the 'complete' key starting with ssh-rsa and ending with your username and host. If you want to upload code from other computers you will need to do this in each computer. You can save different keys in your profile.


Even if there is only one person working in a project Git needs a name to know who make changes to a project:

 $ git config --global "username"
 $ git config --global ""

Create or go to the directory where you want to create a Git repository (i.e. git_repo) and run:

 ~/git_repo$ git ini
  Initialized empty Git repository in ~/ejemplo_git/.git/

Or if you already have code in GitLab and want to import it in a directory use the command “git clone”. (You can copy this from Project tab in the SSH box)

~/git_repo$ git clone ssh://<user_name>/<project_name>.git

Using Git

Now that Git is configurated we can start to upload our scripts/files to our repository:


This is very useful to know the current status of our files.

~/git_repo$ git status
	On branch master
	Untracked files:
	  (use "git add <file>..." to include in what will be committed)
	nothing added to commit but untracked files present (use "git add" to track)


First Git has to track the file. In other words, it has to notice there is something to add to the repository.

If you want to add all files in the directory:

~/git_repo$ git add .

Or selected files:

~/git_repo$ git add .gitignore

Again git status:

~/git_repo$ git status
	On branch master
	Initial commit
	Changes to be commited:
  (use «git rm --cached <file>...» to unstage)
	new file:
	new file:   .gitignore


With commit we save an actual image of the file and let us write a message. Don't forget to use add before commit.

~/git_repo$ git commit -m "two new files"

[master (root-commit) 519caba] two new files
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README
 create mode 100644

Add + commit

To save time we can add and commit a file at the same time:

~/git_repo$ git commit -a -m "message"


This is the final step to upload our commited files to the repository

~/git_repo$ git push

Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 275 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 1 (delta 0)
To ssh://<user_name>/git_repo.git
   fa8b3ac..568ecf3 ejemplo_git -> ejemplo_git

And now the files are saved in GitLab.

users/guides/git.txt · Last modified: 2019/09/03 12:51 by admins_ceab