wiki:cypress/git

Version 1 (modified by fuji, 6 years ago) (diff)

Version Control with git

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.

To use git on Cypress, you have to load module. It is better to set this in .modulerc

[fuji@cypress2 workshop]$ module load git

Create a project repository

On your project directory, for example, (replace dpg with your project folder name)

[fuji@cypress2 ~]$ cd /lustre/project/dpg
[fuji@cypress2 dpg]$ mkdir repos
[fuji@cypress2 dpg]$ cd repos
[fuji@cypress2 repos]$ mkdir git
[fuji@cypress2 repos]$ cd git
[fuji@cypress2 git]$ mkdir projectX
[fuji@cypress2 git]$ cd projectX
[fuji@cypress2 projectX]$ git init
Initialized empty Git repository in /lustre/project/dpg/repos/git/projectX/.git/

Add a file and commit

[fuji@cypress2 projectX]$ echo "This is README.txt for my git-repo" > README.txt
[fuji@cypress2 projectX]$ git add README.txt
[fuji@cypress2 projectX]$ git commit -m"first commit"
[master (root-commit) 4fe9eae] first commit
 Committer: Hideki Fujioka <fuji@cypress2.cm.cluster>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+)
 create mode 100644 README.txt

Make a clone repository on Cypress,

[fuji@cypress2 ~]$ git clone file:///lustre/project/dpg/repos/git/projectX
Cloning into 'projectX'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
[fuji@cypress2 ~]$ ls
projectX

Make a clone repository over network, (you may have to type password)

Hideki02:~ fuji$ git clone fuji@cypress1.tulane.edu:/lustre/project/dpg/repos/git/projectX
Cloning into 'projectX'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
Hideki02:~ fuji$ ls
projectX

Since git is not a default module on Cypress, you have to set ~/.modulerc like:

#%Module3.2.10
module load git

Attachments (1)

Download all attachments as: .zip