URL-s summary:
- git://git.sv.gnu.org/myproject.git - git lightweight protocol (read-only access)
- ssh://git.sv.gnu.org/srv/git/myproject.git - developer access using SSH
- http://git.sv.gnu.org/r/myproject.git - slow dumb protocol, http-based, for use behind fascist firewalls
Web browser: http://git.sv.gnu.org/gitweb/
Basic commands
Checkout:
git clone git://git.sv.gnu.org/project.git
Firewall checkout: if you're behind a outgoing-traffic-filtering firewall, you can use Git's "dumb protocol" via HTTP - note that this is SLOWER, both for you and Savannah. Avoid if possible, and please tell your local sysadmin to allow outgoing git traffic (port 9418):
git clone http://git.sv.gnu.org/r/project.git
Developer setup
(For git 1.5.1 or newer)
Your identity for when you push commits (strongly recommended):
git config --global user.name "Your Name Comes Here" git config --global user.email you@yourdomain.example.com
Enable colors (optional):
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto
Developer basic commands
Initial push / import:
mkdir test cd test git init touch README # edit/add other files... # Import everything: git add . git commit -m "Initial import" # initial publication to the 'master' branch git push login@git.sv.gnu.org:/srv/git/project.git master
Note: at this point your repository is not setup to merge _from_ the remote branch when you type 'git pull'. You can either freshly 'clone' the repository (see "Developer checkout" below), or configure your current repository this way:
git remote add -f origin login@git.sv.gnu.org:/srv/git/project.git git config branch.master.remote origin git config branch.master.merge refs/heads/master
Developer checkout (via SSH - beware of punctuation):
git clone ssh://login@git.sv.gnu.org/srv/git/project.git # or git clone login@git.sv.gnu.org:/srv/git/project.git
Commit:
cd project/ # <edit some_existing_file> git commit -a -m "I automatically commit modified files" # <edit some_other_existing_file and something_else> git add some_other_existing_file git commit -m "I only marked some_other_existing_file for commit" # Check your changes with the graphical tool gitk # Send everything to Savannah git push
Shallow checkouts
When bandwidth is an issue, people can download the latest version of your repository without downloading all the history, using "shallow checkouts". Note that such a copy has limitations, see http://www.kernel.org/pub/software/scm/git/docs/git-clone.html , option --depth for details.
Example:
$ git clone --depth 1 git://git.sv.gnu.org/gnulib.git Initialized empty Git repository in /tmp/gnulib/.git/ remote: Counting objects: 9897, done. remote: Compressing objects: 100% (5462/5462), done. Indexing 9897 objects... remote: Total 9897 (delta 7382), reused 5737 (delta 4419) 100% (9897/9897) done Resolving 7382 deltas... 100% (7382/7382) done $ du -sh gnulib/.git 6,3M gnulib/.git $ du -sh full-gnulib/.git 28M full-gnulib/.git
git-cvsserver pserver compatibility
You can download a git repository using the CVS client, thanks to a pserver-compatible server from git:
$ cvs -d:pserver:anonymous@pserver.git.sv.gnu.org:/autoconf.git co -d autoconf master cvs checkout: Updating autoconf U autoconf/.cvsignore U autoconf/.gitattributes U autoconf/.gitignore U autoconf/.x-sc_prohibit_atoi_atof U autoconf/.x-sc_space_tab U autoconf/.x-sc_sun_os_names U autoconf/.x-sc_trailing_blank U autoconf/.x-sc_useless_cpp_parens U autoconf/AUTHORS U autoconf/BUGS U autoconf/COPYING ...
CVS import
Git comes with the right tool, called git-cvsimport.
This tool use an authors file to map username->real name (option -A) it looks like this:
rms = Richard M. Stallman <rms@gnu.org> toto = Another User <me@mydomain.com> ...
Common invokation:
git-cvsimport -A ../authors.txt -p x -v -d :pserver:anonymous@cvs.savannah.nongnu.org:/sources/$project $module
Most remarks given in the following section (SVN import) also applies to CVS import.
SVN import
Git comes with 2 SVN-related tools: git-svnimport and git-svn. git-svnimport is for importing revisions (a one-shot import, or incrementally); git-svn is a 2-way gateway to a SVN repository, similar to SVK, more useful for maintaining a local branch than for importing a repository (IMHO). We'll use git-svnimport.
Those tools use an authors file to map username->real name (option -A) it looks like this:
rms = Richard M. Stallman <rms@gnu.org> toto = Another User <me@mydomain.com> ...
Common invokation:
git-svnimport -v -I .gitignore -A ../authors.txt file:///home/me/svn_repo
To ignore branches:
git-svnimport -v -I .gitignore -A ../authors.txt -b idontexist file:///home/me/svn_repo
git-svnimport assumes there's a trunk, a branches, and a tags directory (names are configurable) and ignores other directories. You may run into troubles if your layout changed during your former SVN life.
You'll usually perform the import several times before getting what you want. For this reason it's preferable to rsync the SVN repository locally, or create it from a dump:
rsync -av rsync://svn.sv.gnu.org::svn/myproject svn_repo wget http://svn.gna.org/daily/myproject.dump.gz svnadmin init svn_repo zcat myproject.dump.gz | svnadmin load svn_repo/
GNU Arch import
Use git-archimport.
Example importing a project with a project--main--1.0 main archive and a project--release--1.7 tag, converting the Arch-style names into Git-style names:
git-archimport me@domain.tld--2007/project--main--1.0:master project--release--1.7:v1.7
Push existing or converted repository
If you are importing a repository with tags, e.g. for past releases, use the --tags option to send them with the initial import:
git push --tags -v login@git.sv.gnu.org:/srv/git/project.git master
Links
- repo.or.cz: hosting system similar to Savannah. Offers a public ''mob'' branch. The internals look a bit ad-hoc (lots of cron jobs that changes all permissions, privileges to Apache instead of a cron'd backend).
- http://git.or.cz/course/ - "switching to git" crash course (from CVS, Git, and also Quilt->StGit?)
- http://www.kernel.org/pub/software/scm/git/docs/tutorial.html - Tutorial
- http://www.kernel.org/pub/software/scm/git/docs/everyday.html - Everyday GIT With 20 Commands Or So