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
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
)
Mercurial and Git
Git is popular. However, it doesn't always have the best UI. For example, the Eclipse plugin for Git is.... a work in progress. Fortunately, the
MercurialEclipse plugin is a lot better (
http://www.javaforge.com/project/HGE
), and can be made to work with Git using the Hg-Git (
http://hg-git.github.com/
) plugin for Mercurial. I've done this on a Mac, in particular.
- Note that use of this plugin is quite problematic in some cases, particular where users of only Git and users of the Hg-Git plugin are sharing a repository and creating branches. We're now recommending that users avoid this plugin if at all possible and stick to the Git console tools or Tortoise.
Mercurial+Git+Windows
In principle it's also possible to have
TortoiseHg (
http://tortoisehg.bitbucket.org/
) clone and push to a Git repository, but at present
we recommend TortoiseGit over this indirect use of TortoiseHg. That said, a tutorial to do this can be found at:
http://jamesmckay.net/2010/06/tortoisehg-as-a-github-client-on-windows/
Note that to make mercurial successfully clone from git+ssh repositories (as opposed to, for example, github), we had to make a copy of
TortoiseHg\TortoisePlink.exe called ssh.exe, and ensure this was in the Windows path. You may also want to enable the Hg bookmarks plugin.
One might do this to attempt to make
MercurialEclipse work in Windows.
Note that we have not yet successfully configured MercurialEclipse+hg-git+Windows and had it perform all functions (clone, synchronize) successfully, so for now recommend using
TortoiseGit to do version control separately from Eclipse. That said, if you want to try, a few tips are: In
MercurialEclipse you will need to go to Window>Preferences>Team>Mercurial and set the mercurial executable to use
TortoiseHg\hg.exe instead of the bundled version.
--
ChrisNell - 23 Jun 2010