Project

General

Profile

Git Help

Git documentation

Basics

Initial clone

Authenticated clone:

$ git clone ssh://p-orka-ilcroot@cdcvs.fnal.gov/cvs/projects/orka-ilcroot

Anonymous clone:

$ git clone http://cdcvs.fnal.gov/projects/orka-ilcroot

If you start with an anonymous clone it can be converted into an authenticated clone. The example assumes you name it "redmine":

$ git remote add redmine ssh://p-orka-ilcroot@cdcvs.fnal.gov/cvs/projects/orka-ilcroot
$ git pull redmine master
$ git push redmine master

If you want to remove the anonymous remote (initially "origin" by convention) and change the authenticated one from "redmine" to the conventional "origin" do:

$ git remote rm origin
$ git remote rename redmine origin
$ git pull
$ git push

Status of local repository

To see what git thinks of your working directory and local repository do:

$ git status
# On branch master
nothing to commit (working directory clean)

Add new or modified files and commit them locally

Any new file must first be added. Any modified file must also be added or the "-a" switch can be used

$ git add new_file old_but_modified_file

To commit just the explicitly added files

$ git commit -m "Some useful commit message" 

You always must add new files but if you only have modified files then you don't need to explicitly add them and instead use the "-a" flag:

$ git commit -a -m "Some useful commit message" 

Upload commits to Redmine

The commits above are only in your local git repository. To make them available from the central Redmine one you must "push" them.

$ git push

Getting others commits

To download and merge other's commits use "pull"

$ git pull

If conflicts occur, fix them by editing the conflicting files and do a commit followed by another pull.

Problems

Authenticated cloning (or later pushing) fails:

$ git clone ssh://p-orka-ilcroot@cdcvs.fnal.gov/cvs/projects/orka-ilcroot
Cloning into 'orka-ilcroot'...
Received disconnect from 131.225.108.132: 2: Too many authentication failures for p-orka-ilcroot
fatal: The remote end hung up unexpectedly

This can be due to not having a Kerberos ticket. Fix by doing:

$ kinit user@FNAL.GOV
$ git clone ...