TurnKey Linux Virtual Appliance Library

Redmine

Making a new git repository

After setting up the git repo manually, and in anyway way you like, you must do these two things, if you want to be able to access it using the git:// protocol:

touch /srv/repos/git/newRepoName/.git/git-daemon-export-ok

and

ln -s /srv/repos/git/newRepoName/.git /var/cache/git/newRepoName.git

Comments

Trying to get GIT push working

Hi I am trying to get the push capability working with redmine with not much luck.

I have tried to do the following on computer "A" on a VM installation on 10.106.1.109

git clone git://10.106.1.109/git/helloworld
cd helloworld
touch X
git add X
git commit -a -m "X"

Then when I do

git push

I get the following

Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 302 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
error: unpack failed: unpack-objects abnormal exit
To git://10.106.1.109/git/helloworld
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'git://10.106.1.109/git/helloworld'

I also get the following on the logs

2011-09-10_22:45:10.49666 [2150] Extended attributes (19 bytes) exist <host=10.106.1.109>
2011-09-10_22:45:10.49689 [2150] Request receive-pack for '/git/helloworld'
2011-09-10_22:45:10.55044 [2150] error: insufficient permission for adding an object to repository database ./objects
2011-09-10_22:45:10.55047 [2150]
2011-09-10_22:45:10.55053 [2150] fatal: failed to write object
2011-09-10_22:45:10.55659 [643] [2150] Disconnected

If I tried using SSH using the following command and executed the rest of the commands (except for clone)

git clone ssh://root@10.106.1.109/srv/repos/git/helloworld

I get the following on the console, not sure where the SSH logs go.

Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 302 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://root@10.106.1.109/srv/repos/git/helloworld
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://root@10.106.1.109/srv/repos/git/helloworld'

Now if I try using the public git URI

git clone git://10.106.1.109/git/helloworld.git

I get the following

Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 302 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
error: unpack failed: unpack-objects abnormal exit
To git://10.106.1.109/git/helloworld.git
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'git://10.106.1.109/git/helloworld.git'

And the logs show

2011-09-10_22:49:47.18087 [2446] Connection from 10.106.1.102:62482
2011-09-10_22:49:47.18176 [2446] Extended attributes (19 bytes) exist <host=10.106.1.109>
2011-09-10_22:49:47.18208 [2446] Request receive-pack for '/git/helloworld.git'
2011-09-10_22:49:47.22885 [2446] error: insufficient permission for adding an object to repository database ./objects
2011-09-10_22:49:47.22887 [2446]
2011-09-10_22:49:47.22892 [2446] fatal: failed to write object
2011-09-10_22:49:47.23461 [643] [2446] Disconnected

Finally if I tried to do the SSH with the public git using the following

git clone ssh://root@10.106.1.109/srv/repos/git/public/helloworld.git

I get the following

Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 302 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://root@10.106.1.109/srv/repos/git/public/helloworld.git
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://root@10.106.1.109/srv/repos/git/public/helloworld.git'

Same problem

I am having the same problem as Archimedes. Does anyone have any thoughs on getting git push to work? What permission issues are we missing?

Trying to get GIT push working

Yeah - I too am experiencing similar problems

Has anyone found a solution

Has anyone found a solution for this?

  I think I found the key to

 

I think I found the key to this. cd into the directory where the remote repository is via SSH and run this:

git config --bool core.bare true

So to recap what I do to create a new remote repository:

cd /srv/repos
mkdir <newrepo>
cd <newrepo>
git init
git config --bool core.bare true
touch /srv/repos/<newrepo>/.git/git-daemon-export-ok
ln -s /srv/repos/<newrepo>/.git /var/cache/<newrepo>.git
 
This creates the new repo. I can then push to it by linking up using
 
git remote add <newrepo> <user>@<ipaddress>:/var/cache/<newrepo>.git
git push <newrepo> master