blob: 0a88bd095d18e94ace1b2896abfee140523af840 [file] [log] [blame]
briansaede41c2013-02-18 04:41:19 +00001Some us are using git for managing quickly changing code. This file has
jerrymcea3b8d2013-03-11 07:57:37 +00002notes for setting that up.
3
4ssh to robotics.mvla.net and add the git executables to your .bashrc:
5 PATH=$PATH:/www/https/files/frc971/2013/brian/
briansaede41c2013-02-18 04:41:19 +00006
7[Cloning]
8`git clone \
jerrymcea3b8d2013-03-11 07:57:37 +00009 ssh://USERNAME@robotics.mvla.net/www/https/git/frc971/SOMEBODY/2013.git`
10 where USERNAME is your login on the server and SOMEBODY is whoever's git
briansaede41c2013-02-18 04:41:19 +000011 repo you want to clone
Brian Silverman319ba342013-04-14 22:03:36 -070012If you don't have a login on the server, then cloning
Brian Silvermanc2a5ae32013-02-21 20:35:32 -080013 https://robotics.mvla.net/git/frc971/somebody/2013.git instead should work
14 (with your SVN username and password). However, that form of URL is read-
Brian Silverman529508d2013-02-21 20:49:52 -080015 only. In order for this to work, you have to either set the environment
16 variable GIT_SSL_NO_VERIFY to 1 or set the git option http.sslverify to false.
Brian Silverman319ba342013-04-14 22:03:36 -070017 If you get an error like the one below, install a newer version of git.
18 Unable to find 8fcd87533b76ca5b4b83fb6031ddf0de5e03eb57 under https://robotics.mvla.net/git/frc971/brian/2013.git
19 Cannot obtain needed object 8fcd87533b76ca5b4b83fb6031ddf0de5e03eb57
20 error: Fetch failed.
21 I get this error sometimes with version 1.7.2.5 but not with version 1.7.10.4.
briansaede41c2013-02-18 04:41:19 +000022
23[Adding Other People's Repositories]
jerrymcea3b8d2013-03-11 07:57:37 +000024`git remote add SOMEBODY \
Brian Silverman319ba342013-04-14 22:03:36 -070025 ssh://USERNAME@robotics.mvla.net/www/https/git/frc971/SOMEBODY/2013.git`
jerrymcea3b8d2013-03-11 07:57:37 +000026 where USERNAME is your login on the server and SOMEBODY is another person's
briansaede41c2013-02-18 04:41:19 +000027 git repository
Brian Silverman319ba342013-04-14 22:03:36 -070028The https:// URL discussed above in [Cloning] will work too.
briansaede41c2013-02-18 04:41:19 +000029
briansae54f072013-02-18 05:24:06 +000030[Working with Other People's Repositories]
jerrymcea3b8d2013-03-11 07:57:37 +000031`git fetch SOMEBODY` will pull their changes, and then you can rebase on top of
briansae54f072013-02-18 05:24:06 +000032 them etc.
33`git push --mirror` will push all of your local branches so that everybody else
jerrymcea3b8d2013-03-11 07:57:37 +000034 can see them. (This is the default if the configuration option remote.<remote>.mirror is set.)
Brian Silvermanc2a5ae32013-02-21 20:35:32 -080035 However, you can not do that with an https:// URL.
brians66d57302013-02-18 05:10:42 +000036
briansaede41c2013-02-18 04:41:19 +000037[Synchronizing with SVN]
jerrymcea3b8d2013-03-11 07:57:37 +000038In order to synchronize the git commits with svn, somebody has to set up git-svn in their local git repo and then push/pull commits.
39
40To do that, `git svn init https://robotics.mvla.net/svn/frc971/2013/trunk/src`
41
Brian Silverman319ba342013-04-14 22:03:36 -070042Then, unless you want git-svn to pull down everything from SVN again, you have to edit .git/refs/remotes/git-svn (or whatever you name the remote) in your local repository and put in the commit ID of the latest commit in the repository that's from SVN.
jerrymcea3b8d2013-03-11 07:57:37 +000043
Brian Silverman319ba342013-04-14 22:03:36 -070044After doing that (and a `git svn fetch`), git-svn works like usual (see git-svn(1) for details).
jerrymcea3b8d2013-03-11 07:57:37 +000045
46To pull changes from svn, do `git-svn fetch`. To push changes to svn, do `git svn dcommit`, which will take all of your git commits between the latest commit from svn and your HEAD and make them into svn commits.
47
Brian Silverman319ba342013-04-14 22:03:36 -070048Multiple people dealing with svn works OK because the git commit SHAs end up the same so they all just become the same objects.
49
50[Server Setup]
51To get started working with git on the server, first you have to set up your
52 .bashrc so that the git tools work. To do that, add the following line to your
53 .bashrc *ABOVE* the '[ -z "$PS1" ] && return' line.
54 PATH=$PATH:/www/https/files/frc971/2013/brian/
55You also need a place to store your files. You will need an adminstrator to
56 create a folder for you in /www/https/git/frc971 (on the server) with the
57 correct permissions and group.
Brian Silvermanc2a5ae32013-02-21 20:35:32 -080058
59[Repository Setup]
Brian Silverman319ba342013-04-14 22:03:36 -070060To create a git repository on the server,
61 "/www/https/git/frc971/brian/bare-git-repo" to wherever you want your
62 repository (using `git init` won't work correctly). The standard location for
63 mirrors of the "https://robotics.mvla.net/svn/frc971/YEAR/trunk/src" folder is
64 "/www/https/git/frc971/USERNAME/YEAR.git".
Brian Silvermanc2a5ae32013-02-21 20:35:32 -080065In order for https:// access to work, you have to make sure to rename
66 .git/hooks/post-update.sample to .git/hooks/post-update (and then run
67 `git update-server-info` if you're not going to push immediately).
Brian Silverman319ba342013-04-14 22:03:36 -070068
69To learn more about git, see git(1) (`man git` or
70 <http://manpages.debian.net/cgi-bin/man.cgi?query=git>) (especially the NOTES
71 section).