Difference between revisions of "Creating Shared Git Repo"

From LSDevLinux
Jump to: navigation, search
(Add section: Sending email automatically)
(Helpful resources:: Promote to a level 2 heading)
 
Line 40: Line 40:
 
  $ chmod a+x post-receive
 
  $ chmod a+x post-receive
  
====Helpful resources:====
+
== Helpful resources ==
  
http://git-scm.com/
+
* http://git-scm.com/
 
+
* http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
+
* http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#public-repositories
 
 
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#public-repositories
 
  
 
[[Category:DVCS]][[Category:Git]][[Category:Linux tools]]
 
[[Category:DVCS]][[Category:Git]][[Category:Linux tools]]

Latest revision as of 11:27, 19 November 2010

Instructions to create a public git repository on our semi-public git repo host

Create an empty repo

local-workstation:$ ssh git.lsdev.sil.org
rahab:$ newgrp lsdevrepo
$ cd /srv/git/lsdev/public
$ mkdir PROJECTNAME.git
$ cd PROJECTNAME.git
$ git init --bare --shared=group
$ umask 2
$ touch git-daemon-export-ok
$ echo git://git.lsdev.sil.org/PROJECTNAME.git >cloneurl

Others can clone this repository using:

$ git clone ssh://USERNAME@git.lsdev.sil.org/srv/git/lsdev/public/PROJECTNAME.git

for read-write access or:

$ git clone git://git.lsdev.sil.org/PROJECTNAME.git

for read-only access.

Filling with content

After you created the shared repo you might want to add some existing files, or at least commit a dummy file to prevent a warning when cloning the repo (warning: You appear to have cloned an empty repository.):

local-workstation:$ git clone ssh://USERNAME@git.lsdev.sil.org/srv/git/lsdev/public/PROJECTNAME.git
$ cd PROJECTNAME
$ cp -a ~/some/files/to/copy . && git add . # copy existing files
$ git commit -m "Initial commit"
$ git push origin master

Sending email automatically

To send email to a list of addresses whenever new commits are pushed to the repo:

$ cd /srv/git/lsdev/public/PROJECTNAME.git
$ git config hooks.mailinglist ADDRESS1,ADDRESS2,…
$ git config hooks.emailprefix "[PROJECTNAME-git] "
$ cd hooks
$ [ ! -e post-receive ] && mv post-receive{.sample,}
$ chmod a+x post-receive

Helpful resources