See also: ManagingCondorSourceTreesWithGit

This page is the place for Git wisdom as it is discovered/created until it can be filed in a more permanent location.

gitweb (bonsai-like support) on bonsai.cs.wisc.edu

A Gitweb service is running on bonsai.cs.wisc.edu, http://bonsai.cs.wisc.edu/gitweb/gitweb.cgi

gitweb setup

The Apache Httpd service on bonsai has the following additional configuration:

<Directory /var/www/html/gitweb>
AllowOverride none
Options ExecCGI -Indexes
AuthType basic
AuthName "Condor Team"
AuthUserFile /var/www/conf/bonsai.passwd
<LIMIT GET POST>
require valid-user
</LIMIT>
</Directory>

Alias gitweb /var/www/gitweb
Alias gitweb/ /var/www/gitweb/

The gitweb CGI is installed under /var/www/html/gitweb and links to the projects that are available via gitweb are created under /var/www/html/gitweb/projects

Additional note, the gitweb.cgi needed some modification to work on the old RH9 box that is bonsai.cs.wisc.edu. Uses of decode_utf8 can only take one argument, and printing &amp;nbsp; and &amp;sdot; seems to be problematic. All changes are marked with a # FW comment.

git-daemon (git:// URL support) on bonsai.cs.wisc.edu (CURRENTLY DISABLED)

This is a read-only git-daemon run on bonsai.cs.wisc.edu. It can service commands git-fetch, git-pull, git-clone and git-archive.

To access it us the URL git://bonsai/ + CONDOR_SRC.git, CONDOR_DOC.git, or CONDOR_EXT.git, e.g. git clone git://bonsai/CONDOR_SRC.git.

git-daemon setup

git-daemon runs as an xinetd service as the apache user, which has an AFS token to access the repository.

$ grep 9418 /etc/services
git             9418/tcp        git-daemon

$ cat /etc/xinetd.d/git-daemon
# description: The git server offers access to git repositories
service git
{
        disable         = yes
        type            = UNLISTED
        port            = 9418
        socket_type     = stream
        wait            = no
        user            = apache
        server          = /unsup/git/bin/git-daemon
        server_args     = --inetd --export-all --enable=upload-archive --base-path=/var/www/html/gitweb/projects
        log_on_failure  += USERID

To enable/disable this service change the disable = yes|no line in the /etc/xinitd.d/git-daemon and remember to send a SIGHUP to the xinetd process.

Checking if I need to git push

To check if you need to git push changes upstream, you can use git push --dry-run. Note that this may require a newer version of git than is available in /unsup as of March 26, 2008. It will be upgraded soon.

Using git with ssh public key authentication

In order to use git with ssh and public key authentication, you need to do the following:

Create a file /etc/krb5.conf with the following contents:

[libdefaults]
        default_realm = CS.WISC.EDU
[realms]
        CS.WISC.EDU = {
                kdc = kerberos.CS.WISC.EDU:88
                kdc = kerberos-1.CS.WISC.EDU:88
                kdc = kerberos-2.CS.WISC.EDU:88
                admin_server = kerberos.CS.WISC.EDU
                default_domain = CS.WISC.EDU
        }

[domain_realm]
        .cs.wisc.edu = CS.WISC.EDU
        cs.wisc.edu = CS.WISC.EDU
        .stat.wisc.edu = CS.WISC.EDU
        stat.wisc.edu = CS.WISC.EDU

Get a Kerberos ticket: kinit <i>username</i>

Add the following to your ~/.ssh/config file:

Host gitssh
  User username
  Hostname host.cs.wisc.edu
  ChallengeResponseAuthentication no
  PreferredAuthentications gssapi-with-mic,password
  ForwardAgent yes
  GSSAPIAuthentication yes
  GSSAPIDelegateCredentials yes

Then, the repository is available at: ssh://gitssh/p/condor/repository/CONDOR_SRC.git

Pushing only a single branch

A naked git push will try to push all branches up, which may not be what you want. Even if you don't have changes on some branches, it will check if the origin is newer and will complain if the branch is pushed. For example, if you've made changes to V7_0-branch, but not the master, but the master has changed on the upstream git repository, you might see this:

% git push
Counting objects: 9, done.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 767 bytes, done.
Total 5 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
To /p/condor/repository/CONDOR_SRC.git
   3082206..2f05b12  V7_0-branch -> V7_0-branch
 ! [rejected]        master -> master (non-fast forward)
error: failed to push some refs to '/p/condor/repository/CONDOR_SRC.git'

This is harmless, but distracting. The solution is to push only the branch you care about: git push origin V7_0-branch

Hooks

The post-update hook is run after every push. We've changed this (in $GIT_DIR/hook/post-update) to run git update-server-info, so that it doesn't need to be done by hand anymore.

What releases include this commit

<p>It's occasionally useful to determine which releases include a given commit, typically so you know which branches you need to fix a bug on. Assuming you're interested in commit a56c825f, use the following:

git tag --contains a56c825f | egrep '^V[0-9]*_[0-9]*_[0-9]*$'