Git
We have set up a common remote location for git repositories. These repositories are located on the netapp filesystem at
/ubc/cs/project/arrow/git
. Note that these should be
bare remote repositories, and in particular should not have an associated working copy.
Members of the
klb
group should have permissions to work with repositories located here.
Important: creators of / committers to Git repositories hosted here should ensure their default
umask
is
027
at most, to ensure that other
klb
users can read, write, and search their additions! To do this, edit either
~/.bashrc
or
~/.cshrc
(depending on whether you use BASH or CSh by default) and add the line
umask 027
.
It is also a good idea, especially for windows code committers, to ensure they use Unix-style line endings.
A concise introduction to remote Git repositories for
CVS users, which is the basis for many of these instructions, can be found at:
http://www.kernel.org/pub/software/scm/git/docs/gitcvs-migration.html
A good cheat sheet for commandline git users is available at:
https://git.wiki.kernel.org/index.php/GitCheatSheet
CVS repository"> Importing a CVS repository
These instructions use the cvsimport script included with Git, and should be sufficient for migrating most papers, or other relatively simple repositories. A more powerful alternative involves use of cvs2git, and is not covered here.
For example, to import a
CVS repository located at
/ubc/cs/project/arrow/cvs/PAPER
to a Git repo at
ubc/cs/project/arrow/git/PAPER
:
1. Ensure your CVSROOT environment variable is set appropriately; eg:
export CVSROOT=/ubc/cs/project/arrow/cvs
2. (optional) Ensure relevant authorship info is configured by editing
/ubc/cs/project/arrow/git/authors
. Authors not listed therein will be referred to in all logs by their UNIX username rather than their full name/email.
3. Import the repository to a temporary location, say
~/myrepo
:
git cvsimport -i -a -v -C ~/myrepo -A /ubc/cs/project/arrow/git/authors PAPER
4. Create the remote repository (see next section)
5. Remove the temporary repository (unless you want to keep it as a local working repo)
rm -rf ~/myrepo
Creating a remote repository from an existing Git repository
(Taken from
http://www.kernel.org/pub/software/scm/git/docs/gitcvs-migration.html
)
We assume you have already created a git repository, for example by importing from
CVS (above). Assume your existing Git repo is at
~/myrepo
on a machine with UBC network access. Create a new "bare" repository and fetch your project into it:
$ mkdir /ubc/cs/project/arrow/git/myrepo
$ cd /ubc/cs/project/arrow/git/myrepo
$ git --bare init --shared
$ git --bare fetch ~/myrepo master:master
Using TortoiseGit (Windows) with remote repositories
In order to install
TortoiseGit:
1. Download and install Git for Windows from
http://msysgit.googlecode.com/files/Git-1.7.0.2-preview20100309.exe
.
You should disable all the options for shell integration, as this doubles up on what Tortoise provides. It's very hard to get rid of once you've installed it so it's important to omit here. I'd also disable the extra icons, which are unnecessary but easy to remove. On the next screens, I kept the default options.
2. Download and install
TortoiseGit from
http://code.google.com/p/tortoisegit/
3. After a restart, you should be able to clone a remote repository. A sample repository you can play with is located at:
git+ssh://okanagan.cs.ubc.ca/ubc/cs/project/arrow/git/Sample
You will need to provide SSH credentials for an account in
klb
group to access it.
Remember to set the default
umask
of this account to (at most) 027, in order that others might see your work. NB: to set up a .ppk ssh key if you don't have one, see
http://linux-sxs.org/networking/openssh.putty.html
You should set your user info in
TortoiseGit so commits are properly attributed; go to Settings>Git to do this.
- many more commands are available in the TortoiseGit menu if you hold shift before right-clicking. For example, you must do this to delete a branch (
Shift+Rclick>TortoiseGit>Browse Reference
)
Using TortoiseGit (Windows) with remote repositories
In order to install
TortoiseGit:
1. Download and install Git for Windows from
http://msysgit.googlecode.com/files/Git-1.7.0.2-preview20100309.exe
.
You should disable all the options for shell integration, as this doubles up on what Tortoise provides. It's very hard to get rid of once you've installed it so it's important to omit here. I'd also disable the extra icons, which are unnecessary but easy to remove. On the next screens, I kept the default options.
2. Download and install
TortoiseGit from
http://code.google.com/p/tortoisegit/
3. After a restart, you should be able to clone a remote repository. A sample repository you can play with is located at:
git+ssh://okanagan.cs.ubc.ca/ubc/cs/project/arrow/git/Sample
You will need to provide SSH credentials for an account in
klb
group to access it.
Remember to set the default
umask
of this account to (at most) 027, in order that others might see your work. NB: to set up a .ppk ssh key if you don't have one, see
http://linux-sxs.org/networking/openssh.putty.html
You should set your user info in
TortoiseGit so commits are properly attributed; go to Settings>Git to do this.
- many more commands are available in the TortoiseGit menu if you hold shift before right-clicking. For example, you must do this to delete a branch (
Shift+Rclick>TortoiseGit>Browse Reference
)
Eclipse and Git
Git is popular. However, it doesn't always have the best UI. For example, the Eclipse plugin for Git is not as polished as that for
CVS. That said, it is under active development (Eclipse itself is switching to Git) and if you use Eclipse Helios, the plugin is usable for many common cases (you still may have to fall back to the command line for more complex merging tasks).
--
ChrisNell - 23 Jun 2010