SSH keys and repositories

Some instructions for ssh, svn, and git

Helpful SVN commands

  • Update to an old version of a file: svn update -r [rev] path/to/repo
  • View an old version of a file: svn cat -r [rev] path/to/repo | more
  • View a revision's changeset (this command may give no output if the specified path/file wasn't changed): svn diff -c [rev] path/to/repo
  • View a revision's list of changed files: svn log -v -r [rev]

Accessing a git server

After sending the administrator your public SSH key server administrator and adding your key using ssh-add (see above) you can clone a git repository using

git clone gituser@host.name.univ.edu:repository_name
Notice that the "username" in this command is "gituser", not anything having to do with your local username or your real name. (Most git servers do not create a separate account for each git repository user.) Do not send your private key to the server administrator.

In order to avoid having to explicitly use ssh-add, you can create an entry in your SSH config file for the git server containing the lines

	      Hostname host.name.univ.edu
	      User gituser
	      IdentityFile ~/.ssh/my_rsa
where ~/.ssh/my_rsa is the filename for your private key which you are using for the git repository. Note that this need not be the same key pair which you use for ssh.

Helpful git commands

  • Checkout an earlier revision: git checkout <rev>
  • Checkout a branch on the remote: git checkout -t origin/<branch>
  • List all branches: git branch -a
  • Update local with list of remote branches: git fetch
  • Create a new branch: git branch <branch_name>
  • Delete a branch: git branch -d <branch_name>
  • Get a single file from a revision: git show <rev>:file

Acknowledgements

Some of this I have based on Christian Ott's blog post.


Back to Andrew W. Steiner at the University of Tennessee.