Git

From ScientificComputing
Jump to: navigation, search

Category

Development, Version Control

Description

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.

Available versions

Legacy versions Supported versions New versions
1.9.0, 2.11.0

Environment modules

Version Module load command Additional modules loaded automatically
1.9.0 module load gcc/4.8.2 git/1.9.0 legacy centos_cruft/6
2.11.0 module load gcc/4.8.2 git/2.11.0 legacy centos_cruft/6

Example

You can download a github repository with the git clone command:
[leonhard@euler03 ~]$ git clone https://github.com/astropy/astropy.git
Initialized empty Git repository in /cluster/home/leonhard/astropy/.git/
remote: Counting objects: 111782, done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 111782 (delta 34), reused 0 (delta 0), pack-reused 111722
Receiving objects: 100% (111782/111782), 49.05 MiB | 16.04 MiB/s, done.
Resolving deltas: 100% (85075/85075), done.
[leonhard@euler03 ~]$
Please have a look at the git documentation for more information on the different git commands.

License information

GPLv2

Troubleshooting

Contrary to the login nodes, then compute nodes can not access the internet directly. Therefore git will display an error message, when you try to download a git repository as part of a batch job:
[leonhard@e1130 ~]$ git clone https://github.com/astropy/astropy.git
Initialized empty Git repository in /cluster/home/leonhard/astropy/.git/
error: Failed connect to github.com:443; Operation now in progress while accessing https://github.com/astropy/astropy.git/info/refs

fatal: HTTP request failed
[leonhard@e1130 ~]$

This problem can be solved by configuring your git proxy settings first:

[leonhard@e1130 ~]$ git config --global http.proxy http://proxy.ethz.ch:3128
[leonhard@e1130 ~]$ git config --global https.proxy http://proxy.ethz.ch:3128
[leonhard@e1130 ~]$ git clone https://github.com/astropy/astropy.git
Initialized empty Git repository in /cluster/home/leonhard/astropy/.git/
remote: Counting objects: 111782, done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 111782 (delta 34), reused 0 (delta 0), pack-reused 111722
Receiving objects: 100% (111782/111782), 49.05 MiB | 12.84 MiB/s, done.
Resolving deltas: 100% (85075/85075), done.
[leonhard@e1130 ~]$

The global proxy configuration of git can be unset by the following commands:

git config --global --unset http.proxy
git config --global --unset https.proxy
Your current git settings are stored in the file $HOME/.gitconfig.

Links

https://git-scm.com

https://en.wikipedia.org/wiki/Git