How to set up Git
Table of Contents
Git is a source-code and -versioning system in the same sense as CVS, RCS, Subversion and Perforce. It's arguably the best one now in existence. Git is easily set up, but it differs in enough ways from other systems that it's worth getting help to set it up. That help comes in the form of gitolite.
What will surprise you about gitolite, and confuse you about Git until you "get" it, is that gitolite is itself something you get from Git. Indeed, you'll be "checking out" a project named gitolite-admin and using that to set up and maintain Git for your team—to add users and projects. If you understand this, things will go easier.
This article will assume you wish to get Git up for your workgroup. Mine consists of 6 guys including myself. We're all developers and we all trust each other, but we don't want to trust our Git installation and our repositories willy-nilly to each other mucking directly with the file server where we'll keep the master. Each of the other users will be just like me. My development host is an HP Elite notebook computer. The remote computer where the master will reside we'll call acme; we'll refer to it as the "back-end server" or "back-end repository".
Git is only a download. I'm only interested in Ubuntu here, but installation using Yum, Yast, generic RPM, or on Solaris, HP/UX, AIX, etc. would not be greatly different once you got the download in place and installed.
This first bit you should accomplish. Ensure your aptitude package manager is up to date, then install Git. You will want to do the same thing on your back-end "server" as you do on your development client.
root@russ-elite-book:~> apt-get update root@russ-elite-book:~> apt-get install git-core
If you want documentation and Git GUI (I've never used it), then you might want to get all of that at the same time:
root@russ-elite-book:~> apt-get install git-core git-doc git-gui
In order to do anything with the back-end repository, you'll need to set up a key (or you'll have to type a password each and every time you do the least little thing. This is best understood by reading Setting up SSH keys.
Now for the real set-up. As we set up gitolite we'll set up users and projects. Start by using Git to obtain gitolite. Go somewhere in your filesystem where you'd like to keep your source code projects. Notice that I'm no longer root when I do these commands. (I'll let some of the noise show through here, but just because you see something in your console that you don't see here doesn't mean it's not supposed to happen.)
Our first effort is on the back-end server, where the master repository will live. Here are the steps, most of which will be illustrated. In grey are steps done prior to setting up gitolite.
As user email@example.com (you'll use your own user on the "server")...
firstname.lastname@example.org:~> git clone https://github.com/sitaramc/gitolite.git gitolite-source Cloning into gitolite-source... remote: Counting objects: 3957, done. remote: Compressing objects: 100% (1587/1587), done. remote: Total 3957 (delta 2717), reused 3409 (delta 2322) Receiving objects: 100% (3957/3957), 1.00 MiB | 868 KiB/s, done. Resolving deltas: 100% (2717/2717), done. email@example.com:~> ll total 20 drwxr-xr-x 4 russ russ 288 2011-05-04 09:02 ./ drwxr-xr-x 11 root root 248 2011-05-03 05:17 ../ -rw------- 1 root root 445 2011-05-03 07:00 .bash_history -rw-r--r-- 1 russ russ 220 2011-05-03 04:07 .bash_logout -rw-r--r-- 1 russ russ 3468 2011-05-03 05:10 .bashrc drwx------ 2 russ russ 88 2011-05-03 04:09 .cache/ drwxr-xr-x 9 russ russ 336 2011-05-04 09:02 gitolite-source/ -rw-r--r-- 1 russ russ 675 2011-05-03 04:07 .profile -rw-r--r-- 1 russ russ 0 2011-05-03 04:18 .sudo_as_admin_successful -rw------- 1 root root 3484 2011-05-03 05:38 .viminfo
Next, step down into the gitolite-source project. You'll be adding key files and modifying a configuration file (activities analogous to those you'll undertake in your own projects later on). You should see...
firstname.lastname@example.org:~/dev> cd gitolite-source email@example.com:~/dev/gitolite-source> ll total 27 drwxr-xr-x 9 russ russ 336 2011-05-04 09:02 ./ drwxr-xr-x 4 russ russ 288 2011-05-04 09:02 ../ drwxr-xr-x 2 russ russ 120 2011-05-04 09:02 conf/ drwxr-xr-x 6 russ russ 336 2011-05-04 09:02 contrib/ drwxr-xr-x 2 russ russ 1080 2011-05-04 09:02 doc/ drwxr-xr-x 8 russ russ 328 2011-05-04 09:02 .git/ -rw-r--r-- 1 russ russ 140 2011-05-04 09:02 .gitattributes -rw-r--r-- 1 russ russ 44 2011-05-04 09:02 .gitignore drwxr-xr-x 4 russ russ 104 2011-05-04 09:02 hooks/ -rw-r--r-- 1 russ russ 612 2011-05-04 09:02 Makefile -rw-r--r-- 1 russ russ 8791 2011-05-04 09:02 README.mkd drwxr-xr-x 2 russ russ 616 2011-05-04 09:02 src/ drwxr-xr-x 4 russ russ 1544 2011-05-04 09:02 t/
Now just follow along as I set up some things. I hope these steps will all work. If not, you'll have to play around until you get what you want. One thing: I noticed that
firstname.lastname@example.org:~/gitolite-source> git branch * pu email@example.com:~/gitolite-source> sudo mkdir -p /usr/local/share/gitolite/conf /usr/local/share/gitolite/hooks [sudo] password for russ: firstname.lastname@example.org:~/gitolite-source> sudo src/gl-system-install /usr/local/bin /usr/local/share/gitolite/conf /usr/local/share/gitolite/hooks email@example.com:~/gitolite-source> sudo bash firstname.lastname@example.org:~/gitolite-source# su - git email@example.com:~> ll total 16 drwxr-xr-x 5 git git 232 2011-05-04 06:21 ./ drwxr-xr-x 11 root root 248 2011-05-03 05:17 ../ -rw-r--r-- 1 git git 220 2011-03-31 13:26 .bash_logout -rw-r--r-- 1 git git 3353 2011-03-31 13:26 .bashrc drwxr-xr-x 7 git git 248 2011-05-03 05:40 acme.git/ drwx------ 2 git git 88 2011-05-04 06:21 .cache/ -rw-r--r-- 1 git git 675 2011-03-31 13:26 .profile drwx------ 2 git git 128 2011-05-04 06:22 .ssh/ -rw------- 1 git git 634 2011-05-03 05:32 .viminfo firstname.lastname@example.org:~> which gl-setup /usr/local/bin/gl-setup
Here I had a little trouble. This next step forces vim up so you can edit a file. I had nothing I wanted or knew I needed to say, so I simply quit out of the editing session without changing anything. I actually went through this a couple of times, so I'm not certain what you'll see. Perhaps one of the couple things I show here? This...
email@example.com:~> gl-setup /firstname.lastname@example.org The default settings in the rc file (/home/git/.gitolite.rc) are fine for most people but if you wish to make any changes, you can do so now. hit enter... creating gitolite-admin... Initialized empty Git repository in /home/git/repositories/gitolite-admin.git/ creating testing... Initialized empty Git repository in /home/git/repositories/testing.git/ [master (root-commit) 6f8ddf2] start 2 files changed, 6 insertions(+), 0 deletions(-) create mode 100644 conf/gitolite.conf create mode 100644 keydir/id_rsa.russ.pub
email@example.com:~> gl-setup /firstname.lastname@example.org email@example.com git on acme firstname.lastname@example.org:~> ll repositories/ total 0 drwx------ 4 git git 120 2011-05-04 09:15 ./ drwxr-xr-x 7 git git 392 2011-05-04 09:15 ../ drwx------ 8 git git 296 2011-05-04 09:15 gitolite-admin.git/ drwx------ 7 git git 216 2011-05-04 09:15 testing.git/
Now, turn back to your development host, the computer where you do actual work all day long. I assume you've installed Git here just as for the server. We'll be administering the server piece from the client. Note that Git really isn't a "server/client" thing at all. I'm just an old Subversion guy and because I'm setting up a separate, non-development host as a back-end repository, I just think of it as a server.
If you haven't installed Git on your development host, you'll find out when you do the first command here.
russ@russ-elite-book:~/acme> git clone email@example.com:gitolite-admin Initialized empty Git repository in /home/russ/acme/gitolite-admin/.git/ remote: Counting objects: 6, done. remote: Compressing objects: 100% (4/4), done. remote: Total 6 (delta 0), reused 0 (delta 0) Receiving objects: 100% (6/6), done. russ@russ-elite-book:~/acme> ll total 0 drwxr-xr-x 5 russ russ 120 2011-05-04 16:34 gitolite-admin russ@russ-elite-book:~/acme> cd gitolite-admin/ russ@russ-elite-book:~/acme/gitolite-admin> ll total 0 drwxr-xr-x 2 russ russ 80 2011-05-04 16:34 conf drwxr-xr-x 2 russ russ 80 2011-05-04 16:34 keydir russ@russ-elite-book:~/acme/gitolite-admin> cd conf russ@russ-elite-book:~/acme/gitolite-admin/conf> ll total 4 -rw-r--r-- 1 russ russ 97 2011-05-04 16:34 gitolite.conf russ@russ-elite-book:~/acme/gitolite-admin/conf> gvim gitolite.conf Xlib: extension "RANDR" missing on display ":0.0". russ@russ-elite-book:~/acme/gitolite-admin/conf> cd ../keydir russ@russ-elite-book:~/acme/gitolite-admin/keydir> ll total 4 -rw-r--r-- 1 russ russ 403 2011-05-04 16:34 firstname.lastname@example.org russ@russ-elite-book:~/acme/gitolite-admin/keydir> cd ../conf russ@russ-elite-book:~/acme/gitolite-admin/conf> ll total 4 -rw-r--r-- 1 russ russ 90 2011-05-04 16:37 gitolite.conf russ@russ-elite-book:~/acme/gitolite-admin/conf> gvim gitolite.conf
Here I composed what I wanted for my projects and users. I did something quick and dirty knowing that I'd come back in to do the job right. (More on what I did later, but you will notice that I provided for a team of 6: russ, levi, al, camron, jay and kyle.)
russ@russ-elite-book:~/acme/gitolite-admin/conf> cd .. russ@russ-elite-book:~/acme/gitolite-admin> git status # On branch master # Changed but not updated: # (use "git add/rm
..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: conf/gitolite.conf # # Untracked files: # (use "git add ..." to include in what will be committed) # # email@example.com no changes added to commit (use "git add" and/or "git commit -a") russ@russ-elite-book:~/acme/gitolite-admin> git add Nothing specified, nothing added. Maybe you wanted to say 'git add .'? russ@russ-elite-book:~/acme/gitolite-admin> git add . russ@russ-elite-book:~/acme/gitolite-admin> git status # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: conf/gitolite.conf # new file: firstname.lastname@example.org # russ@russ-elite-book:~/acme/gitolite-admin> git commit [master 349d421] First attempt to set up administration necessities. We'll need keys for the other guys. 2 files changed, 9 insertions(+), 2 deletions(-) (100%) russ@russ-elite-book:~/acme/gitolite-admin> git push Counting objects: 9, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 541 bytes, done. Total 5 (delta 0), reused 0 (delta 0) remote: creating acme... remote: Initialized empty Git repository in /home/git/repositories/acme.git/ remote: remote: ***** WARNING ***** remote: the following users have no pubkeys: remote: al,camron,jay,kyle,levi To email@example.com:gitolite-admin 6f8ddf2..349d421 master -> master russ@russ-elite-book:~/acme/gitolite-admin> git remote -v origin firstname.lastname@example.org:gitolite-admin (fetch) origin email@example.com:gitolite-admin (push)
Despite what I show here, you may find that you'll have to issue the push command thus (instead of "naked" as I was able to do above):
$ git push origin master
After explicitly doing "origin master" you'll find you never have to specify them again.
At this point, whatever project I set up in gitolite.conf is now ready to become the back-end repository and also what the developers clone to get started. I can start working at the front-end—on my development host.
Let's imagine that I'm creating a small RESTful service and a test client for same. I might want two projects with fitting names. Also, as noted above, I've got 5 teammates and all of them are going to be able to administrate Git (just in case I or any of the rest get crushed under a bus). Here's my configutation file:
@admins = russ levi kyle al jay camron repo gitolite-admin RW+ = @admins @acme_repo = rest-server rest-test-client repo testing RW+ = @all repo @acme_repo RW+ = @admins
Since I didn't have this set up elegantly the first time, I have to edit gitolite.conf to rearrange all of this. Originally, I just had a generic project named "acme". I removed this from the configuration and add the two real named projects as shown.
russ@russ-elite-book:~/acme/gitolite-admin/conf> gvim gitolite.conf russ@russ-elite-book:~/acme/gitolite-admin/conf> git status # On branch master # Changed but not updated: # (use "git add
..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: gitolite.conf # no changes added to commit (use "git add" and/or "git commit -a") russ@russ-elite-book:~/acme/gitolite-admin/conf> git add gitolite.conf russ@russ-elite-book:~/acme/gitolite-admin/conf> git status # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: gitolite.conf # russ@russ-elite-book:~/acme/gitolite-admin/conf> cd .. russ@russ-elite-book:~/acme/gitolite-admin> git commit [master d505ca3] Removed "acme" as a project name to replace it with the server and client projects. 1 files changed, 1 insertions(+), 1 deletions(-) russ@russ-elite-book:~/acme/gitolite-admin> git push Counting objects: 7, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 430 bytes, done. Total 4 (delta 1), reused 0 (delta 0) remote: creating rest-server... remote: Initialized empty Git repository in /home/git/repositories/rest-server.git/ remote: creating rest-test-client... remote: Initialized empty Git repository in /home/git/repositories/rest-test-client.git/ remote: remote: ***** WARNING ***** remote: the following users have no pubkeys: remote: camron,jay,kyle,levi To firstname.lastname@example.org:gitolite-admin 983db89..d505ca3 master -> master
(None of my teammates have sent me their public keys yet.) I can go to server tuonela.site and see:
email@example.com/git# ll repositories/ total 0 drwx------ 8 git git 296 2011-05-06 03:05 gitolite-admin.git drwx------ 7 git git 216 2011-05-06 03:05 rest-server.git drwx------ 7 git git 216 2011-05-06 03:05 rest-test-client.git
My actual source code projects are sitting alongside my administration project.
Just to show the utility of gitolite, ...
If you try to connect into the git user on acme.site, you fail with this very informative message:
russ@russ-elite-book:~> ssh firstname.lastname@example.org PTY allocation request failed on channel 0 hello russ, the gitolite version here is v2.0.1-2-g836faf9 the gitolite config gives you the following access: R W gitolite-admin R W rest-server R W rest-test-client Connection to tuonela.site closed.
This tells you a) you can't do this: this is how gitolite preserves the back-end Git repository from mischief and disaster and b) what projects you have access to.
This was given me by my nephew, a long-time Git consumer, for some projects he's been working on. I've changed up the names a bit to preserve his privacy.
repo gitolite-admin RW+ = burton jloveridge @snorkel = burton dantheman @snorkel_repo = photoplugin_testpage PhotoUploaderPlugin @snorkelbreath_repo= fbgen_web snorkelbreath snorkelbreath-mirror @snorkelbreath = burton jloveridge bloveridge dantheman @wildcard_users = burton jloveridge bloveridge eric repo snorkelbreath-mirror snorkelbreath R = daemon gitweb repo @snorkelbreath_repo RW+ = @snorkelbreath R = sturgeonbreath repo @snorkel_repo RW+ = @snorkel repo CREATOR/.* C = @wildcard_users CREATOR RW+D = CREATOR RW = WRITERS R = READERS repo pub/CREATOR/.* C = @wildcard_users CREATOR RW+D = CREATOR RW = WRITERS R = READERS @all daemon gitweb
Once you've specified access to a new "project" in gitolite.conf for an existing project, you can go to the subdirectory above the project's root, rename it to something temporary, clone the new project under its rightful name (Git will warn of an empty project), then copy everything carefully from the temporary subdirectory. Make sure you get the files that begin with a dot. Then you'll see something like what's going on below. The new project is named sample-rest-server.
(Note that I've re-engineered my bash prompt to make the Git branch visible. And, it's in colors that tell me what state things are in. See How to remember what Git branch I'm working in.)
[master] ~/acme/sample-rest-server $ ll total 44 drwxr-xr-x 9 russ russ 352 2012-02-07 17:26 . drwxr-xr-x 5 russ russ 144 2012-02-07 17:23 .. -rw-r--r-- 1 russ russ 7918 2012-02-07 17:24 build.xml -rw-r--r-- 1 russ russ 7427 2012-02-07 17:25 .classpath drwxr-xr-x 3 russ russ 184 2012-02-07 17:24 extras drwxr-xr-x 7 russ russ 248 2012-02-07 17:23 .git -rw-r--r-- 1 russ russ 32 2012-02-07 17:29 .gitignore drwxr-xr-x 2 russ russ 48 2012-02-07 17:24 junit drwxr-xr-x 16 russ russ 416 2012-02-07 17:24 lib -rw-r--r-- 1 russ russ 1015 2012-02-07 17:25 .project -rw-r--r-- 1 russ russ 22530 2012-02-07 17:24 README.html drwxr-xr-x 2 russ russ 360 2012-02-07 17:24 .settings drwxr-xr-x 4 russ russ 136 2012-02-07 17:24 src drwxr-xr-x 4 russ russ 128 2012-02-07 17:24 WebContent [master] ~/acme/sample-rest-server $ git status # On branch master # # Initial commit # # Untracked files: # (use "git add
..." to include in what will be committed) # # .classpath # .gitignore # .project # .settings/ # README.html # WebContent/ # build.xml # extras/ # lib/ # src/ nothing added to commit but untracked files present (use "git add" to track) [master] ~/acme/sample-rest-server $ git add . [master] ~/acme/sample-rest-server $ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached ..." to unstage) # # new file: .classpath # new file: .gitignore # new file: .project # new file: .settings/.jsdtscope # new file: .settings/org.eclipse.jdt.core.prefs # new file: .settings/org.eclipse.wst.common.component # new file: .settings/org.eclipse.wst.common.project.facet.core.xml # new file: .settings/org.eclipse.wst.jsdt.ui.superType.container # new file: .settings/org.eclipse.wst.jsdt.ui.superType.name # new file: README.html # new file: WebContent/META-INF/MANIFEST.MF # new file: WebContent/WEB-INF/web.xml # new file: WebContent/index.html # new file: build.xml # new file: extras/build.properties # new file: extras/db.properties # new file: extras/private/README.txt # new file: extras/private/russ/application.properties # new file: extras/private/russ/build.properties # new file: extras/private/russ/db.properties # new file: extras/sample-user-management.sql # new file: lib/ant-contrib/ant-contrib-1.0b3.jar # new file: lib/ant-tasks/sqlscriptpreprocessor.jar # new file: lib/apache/commons-collections-3.1.jar # new file: lib/apache/commons-configuration-1.7.jar # new file: lib/apache/commons-lang-2.6.jar # new file: lib/apache/jakarta-oro-2.0.8.jar # new file: lib/apache/log4j-1.2.16.jar # new file: lib/apache/servlet-api.jar # new file: lib/cobertura/asm-tree-3.0.jar # new file: lib/cobertura/cobertura.jar # new file: lib/gson/gson-1.7.1.jar # new file: lib/hibernate/antlr-2.7.6.jar # new file: lib/hibernate/c3p0-0.9.1.jar # new file: lib/hibernate/dom4j-1.6.1.jar # new file: lib/hibernate/hibernate-jpa-2.0-api-1.0.1.Final.jar # new file: lib/hibernate/hibernate3.jar # new file: lib/hibernate/javassist-3.12.0.GA.jar # new file: lib/hibernate/jta-1.1.jar # new file: lib/jboss/webplatform-servicelocator-1.0.jar # new file: lib/jersey/asm-3.1.jar # new file: lib/jersey/jersey-client-1.6.jar # new file: lib/jersey/jersey-core-1.6.jar # new file: lib/jersey/jersey-json-1.6.jar # new file: lib/jersey/jersey-server-1.6.jar # new file: lib/jersey/oauth-server-1.10.jar # new file: lib/jersey/oauth-signature-1.10.jar # new file: lib/junit/junit-4.10.jar # new file: lib/mockito/mockito-all-1.8.5.jar # new file: lib/mockito/powermock-mockito-1.4.9-full.jar # new file: lib/mongo/mongo-2.6.3.jar # new file: lib/mongo/morphia-0.99.jar # new file: lib/postgres/postgresql-9.1-901.jdbc4.jar # new file: lib/slf4j/slf4j-api-1.6.1.jar # new file: lib/slf4j/slf4j-nop-1.6.1.jar # new file: lib/spring/org.springframework.transaction-3.0.6.RELEASE.jar # new file: src/com/hp/webplatform/oauth/service/OAuthServerWS.java # new file: src/com/hp/webplatform/oauth/service/OAuthWS.java # new file: src/com/hp/webplatform/user/Account.java # new file: src/com/hp/webplatform/user/AccountManager.java # new file: src/com/hp/webplatform/user/AccountWS.java # new file: src/com/hp/webplatform/util/ConfigurationContextListener.java # new file: src/com/hp/webplatform/util/HibernateUtil.java # new file: src/com/hp/webplatform/util/MongoConnectionManager.java # new file: src/com/hp/webplatform/util/OAuthResourceFilter.java # new file: src/com/hp/webplatform/util/OAuthSecurity.java # new file: src/com/hp/webplatform/util/SharedSecurityFilter.java # new file: src/com/hp/webplatform/util/SystemConfiguration.java # new file: src/com/hp/webplatform/util/UTCString.java # new file: src/log4j.properties # new file: src/resources/application.properties # new file: src/resources/hibernate.cfg.xml # new file: src/resources/hibernate.russ.cfg.xml # [master] ~/acme/sample-rest-server $ git commit [master (root-commit) 3fcbb6e] Initial commit of sample-rest-server. 73 files changed, 2376 insertions(+), 0 deletions(-) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .project create mode 100644 .settings/.jsdtscope create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.wst.common.component create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name create mode 100644 README.html create mode 100644 WebContent/META-INF/MANIFEST.MF create mode 100644 WebContent/WEB-INF/web.xml create mode 100644 WebContent/index.html create mode 100644 build.xml create mode 100644 extras/build.properties create mode 100644 extras/db.properties create mode 100644 extras/private/README.txt create mode 100644 extras/private/russ/application.properties create mode 100644 extras/private/russ/build.properties create mode 100644 extras/private/russ/db.properties create mode 100644 extras/sample-user-management.sql create mode 100644 lib/ant-contrib/ant-contrib-1.0b3.jar create mode 100644 lib/ant-tasks/sqlscriptpreprocessor.jar create mode 100644 lib/apache/commons-collections-3.1.jar create mode 100644 lib/apache/commons-configuration-1.7.jar create mode 100644 lib/apache/commons-lang-2.6.jar create mode 100644 lib/apache/jakarta-oro-2.0.8.jar create mode 100644 lib/apache/log4j-1.2.16.jar create mode 100644 lib/apache/servlet-api.jar create mode 100644 lib/cobertura/asm-tree-3.0.jar create mode 100644 lib/cobertura/cobertura.jar create mode 100644 lib/gson/gson-1.7.1.jar create mode 100644 lib/hibernate/antlr-2.7.6.jar create mode 100644 lib/hibernate/c3p0-0.9.1.jar create mode 100644 lib/hibernate/dom4j-1.6.1.jar create mode 100644 lib/hibernate/hibernate-jpa-2.0-api-1.0.1.Final.jar create mode 100644 lib/hibernate/hibernate3.jar create mode 100644 lib/hibernate/javassist-3.12.0.GA.jar create mode 100644 lib/hibernate/jta-1.1.jar create mode 100644 lib/jboss/webplatform-servicelocator-1.0.jar create mode 100644 lib/jersey/asm-3.1.jar create mode 100644 lib/jersey/jersey-client-1.6.jar create mode 100644 lib/jersey/jersey-core-1.6.jar create mode 100644 lib/jersey/jersey-json-1.6.jar create mode 100644 lib/jersey/jersey-server-1.6.jar create mode 100644 lib/jersey/oauth-server-1.10.jar create mode 100644 lib/jersey/oauth-signature-1.10.jar create mode 100644 lib/junit/junit-4.10.jar create mode 100644 lib/mockito/mockito-all-1.8.5.jar create mode 100644 lib/mockito/powermock-mockito-1.4.9-full.jar create mode 100644 lib/mongo/mongo-2.6.3.jar create mode 100644 lib/mongo/morphia-0.99.jar create mode 100644 lib/postgres/postgresql-9.1-901.jdbc4.jar create mode 100644 lib/slf4j/slf4j-api-1.6.1.jar create mode 100644 lib/slf4j/slf4j-nop-1.6.1.jar create mode 100644 lib/spring/org.springframework.transaction-3.0.6.RELEASE.jar create mode 100644 src/com/hp/webplatform/oauth/service/OAuthServerWS.java create mode 100644 src/com/hp/webplatform/oauth/service/OAuthWS.java create mode 100644 src/com/hp/webplatform/user/Account.java create mode 100644 src/com/hp/webplatform/user/AccountManager.java create mode 100644 src/com/hp/webplatform/user/AccountWS.java create mode 100644 src/com/hp/webplatform/util/ConfigurationContextListener.java create mode 100644 src/com/hp/webplatform/util/HibernateUtil.java create mode 100644 src/com/hp/webplatform/util/MongoConnectionManager.java create mode 100644 src/com/hp/webplatform/util/OAuthResourceFilter.java create mode 100644 src/com/hp/webplatform/util/OAuthSecurity.java create mode 100644 src/com/hp/webplatform/util/SharedSecurityFilter.java create mode 100644 src/com/hp/webplatform/util/SystemConfiguration.java create mode 100644 src/com/hp/webplatform/util/UTCString.java create mode 100644 src/log4j.properties create mode 100644 src/resources/application.properties create mode 100644 src/resources/hibernate.cfg.xml create mode 100644 src/resources/hibernate.russ.cfg.xml [master] ~/acme/sample-rest-server $ git push origin master Counting objects: 106, done. Delta compression using up to 4 threads. Compressing objects: 100% (94/94), done. Writing objects: 100% (106/106), 12.70 MiB | 11.62 MiB/s, done. Total 106 (delta 5), reused 0 (delta 0) To email@example.com:sample-rest-server * [new branch] master -> master
All is set up. What I did next was launch Eclipse to create a new workspace. There, I created two projects, a Dynamic Web Project named rest-server and a simple Java Project named rest-test-client. When I used the new project wizards, I didn't keep the default, "create the code in your workspace" option, but instead directed the wizard to create the project and its files over under ~/acme/rest-server and ~/acme/rest-test-client. This way, after getting things up as far as I needed to to get the other guys some place to start, I simply use Git commands:
$ git add $ git commit $ git push [origin master] etc.
...to commit all the files. Later, my work colleagues had nothing harder to do than to create a new Eclipse workspace (or use an old one), set up a new subdirectory to put their work into (just as I use ~/acme), then:
I once set up a team on Git, then found myself away in the hospital for an extended period of time. As they all had access to the box on which the back-end repository was located, I came back to find it unworking. Here are some symptoms:
russ@russ-elite-book:~/poop> git clone firstname.lastname@example.org:gitolite-admin Initialized empty Git repository in /home/russ/poop/gitolite-admin/.git/ open log failed: Permission denied fatal: The remote end hung up unexpectedly ... russ@russ-elite-book:~/poop> git clone email@example.com:rest-test-client Initialized empty Git repository in /home/russ/poop/rest-test-client/.git/ open log failed: Permission denied fatal: The remote end hung up unexpectedly ... russ@russ-elite-book:~/poop> ssh firstname.lastname@example.org info open log failed: Permission denied
I found nothing really screwed up though the teammate who did it told me he had gone in thinking it was a problem with his key (despite my wiki article on it, he didn't know about using gitolite-admin to manage keys).
I took the folllowing steps, though I saw nothing wrong. It was the last one that fixed things, I think.
email@example.com# chown -R git: /home/git firstname.lastname@example.org# chmod -R u+rwx /home/git/.gitolite
There was plenty of looking around the git user on the server to see if I could detect what had happened. No privileges were overtly wrong.