PSAS/ git

For new work, we are now using git, instead of Subversion. See gitweb for a list of git projects hosted on this server. (Look for repositories starting with "psas/".)

You can clone any of our git repositories without any special privileges, by using the anonymous git protocol. For example:

git clone git://git.psas.pdx.edu/git/event-driven-fc

Some of our projects depend on further submodules. For instance, event-driven-fc also depends on the ziggurat submodule. To initialize it:

git submodule init
git submodule update

If you're making changes to one of these git repositories and want to be able to share your work with us, please send your preferred SSH username and an OpenSSH public key to admin@psas.pdx.edu. You probably want to choose a username that matches your local username on whatever computer you usually do development work on. If you don't already have an OpenSSH public key, you can generate one with this command:

ssh-keygen -t dsa

Afterwards you can find your new public key in ~/.ssh/id_dsa.pub. (If you already had a key, you might find that it's named ~/.ssh/id_rsa.pub.)

Once your account is created, you need to use the git+ssh protocol to access the repositories you're working on. For example:

git clone ssh://git.psas.pdx.edu/git/event-driven-fc

Administrators

Creating a new git account

sudo adduser --disabled-password --shell /usr/bin/git-shell --gecos "<Full Name>" <username>
sudo addgroup <username> psas
sudo -u <username> mkdir /home/<username>/.ssh
sudo -u <username> sponge /home/<username>/.ssh/authorized_keys

Now paste the provided key and press Ctrl-D.

Creating a new git repository

First, set up the git repository on the PSAS server:

cd /git
git init --shared --bare <reponame>.git
cd <reponame>.git
touch git-daemon-export-ok

Preferably, also edit the file named "description" with a very short summary of what's in the repository.

Now we have a bare repo with nothing in it. If you don't already have a git repository, you can create one locally now:

git clone ssh://<username>@git.psas.pdx.edu/git/<reponame>

Add and commit your files.

If you already have a git repository (and a sufficiently new version of git; maybe 1.6 or so?) you can link your existing local repository to this new remote one this way:

git remote add -m master origin ssh://<username>@git.psas.pdx.edu/git/<reponame>

In either case, then you'll have to tell it (once):

git push origin master

... and now you're set.

Moving SVN to git

You can use the following commands to convert a PSAS svn repo to git:

git svn clone svn+ssh://username@svn.psas.pdx.edu/svn/psas/trunk/svn-repo-name repo-name.git

Then you can use the commands above to push it to a new git repo and thus happily preserve old history.