Skip to content

Instantly share code, notes, and snippets.

@seanh
Created January 18, 2011 19:28
Show Gist options
  • Select an option

  • Save seanh/784970 to your computer and use it in GitHub Desktop.

Select an option

Save seanh/784970 to your computer and use it in GitHub Desktop.
Sharing a git repository locally
seanh creates a shared, bare repository which members of the 'clickeast'
group can read but not write, and pushes some commits into it:
seanh@kisimul:~ % cd /
seanh@kisimul:/ % sudo mkdir ClickEast.git
seanh@kisimul:/ % sudo chown seanh ClickEast.git
seanh@kisimul:/ % chgrp clickeast ClickEast.git
seanh@kisimul:/ % chmod g+rx ClickEast.git
seanh@kisimul:/ % chmod g+s ClickEast.git
seanh@kisimul:/ % cd ClickEast.git
seanh@kisimul:/ClickEast.git % git init --shared=0640 --bare
Initialized empty shared Git repository in /ClickEast.git/
seanh@kisimul:/ClickEast.git % cd ~/git/dice/ClickEast.git
seanh@kisimul:.../ClickEast.git % git push /ClickEast.git master
Counting objects: 775, done.
Compressing objects: 100% (387/387), done.
Writing objects: 100% (775/775), 21.05 MiB | 19.56 MiB/s, done.
Total 775 (delta 362), reused 775 (delta 362)
To /ClickEast.git
* [new branch] master -> master
seanh@kisimul:.../ClickEast.git %
jamesg clones the repo:
jamesg@kisimul:~$ git clone /ClickEast.git/
Initialized empty Git repository in /home/jamesg/ClickEast/.git/
jamesg@kisimul:~$ cd ClickEast/
jamesg can clone and pull from the repo, but he can't push to it:
jamesg@kisimul:~/ClickEast$ echo 'bar' > foo
jamesg@kisimul:~/ClickEast$ git add foo
jamesg@kisimul:~/ClickEast$ git commit foo -m 'foobar'
[master bdd5124] foobar
Committer: James Garforth <jamesg@kisimul.(none)>
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 foo
jamesg@kisimul:~/ClickEast$ git push /ClickEast.git/
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 276 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To /ClickEast.git/
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to '/ClickEast.git/'
git pull works just fine for jamesg:
jamesg@kisimul:~/ClickEast$ git pull /ClickEast.git/ master
From /ClickEast
* branch master -> FETCH_HEAD
Already up-to-date.
jamesg@kisimul:~/ClickEast$
jamesg needs to make his own shared bare clone of the repo and push to that, then ask seanh to pull from jamesg's shared repo into seanh's shared repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment