0

GIT home dir on server is /srv/gitolite with following configuration:

user@server:~/repositories$ ls -al /srv/gitolite/repositories/
total 20
drwxr-x--- 5 gitolite gitolite 4096 Feb 12 21:23 .
drwxr-x--- 8 gitolite gitolite 4096 Feb 12 21:23 ..
drwx------ 8 gitolite gitolite 4096 Feb 12 21:23 gitolite-admin.git
drwxrwx--- 7 gitolite gitolite 4096 Feb 12 21:23 project.git
drwx------ 7 gitolite gitolite 4096 Feb 12 21:23 testing.git

gitolite@server:/$ cat /srv/gitolite/.gitolite/conf/gitolite.conf

    repo    gitolite-admin
            RW+     =   admin

    repo    testing
            RW+     =   @all

    repo    project
            RW+     =   user

gitolite@server:/$ ls -al /srv/gitolite/.gitolite/keydir/
drwx------ 2 gitolite gitolite 4096 Feb 12 20:55 .
drwx------ 8 gitolite gitolite 4096 Feb 10 23:03 ..
-rw-r--r-- 1 gitolite gitolite  404 Feb 10 23:03 admin.pub
-rw-rw---- 1 gitolite gitolite  404 Feb 11 22:30 user.pub
-rw-rw---- 1 gitolite gitolite  393 Feb 12 20:55 test.pu

On local machine I did:

mato@machine:/tmp$ mkdir test
mato@machine:/tmp$ cd test/
mato@machine:/tmp/test$ vim file.txt
mato@machine:/tmp/test$ git init
Initialized empty Git repository in /tmp/test/.git/
mato@machine:/tmp/test$ git remote add origin user@server:repositories/project.git
mato@machine:/tmp/test$ git add .
mato@machine:/tmp/test$ git commit -m 'test'
[master (root-commit) cb6bc87] test
 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
mato@machine:/tmp/test$ git push origin master:refs/heads/master
Counting objects: 3, done.
Writing objects: 100% (3/3), 215 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: ENV GL_RC not set
remote: BEGIN failed--compilation aborted at hooks/update line 20.
remote: error: hook declined to update refs/heads/master
To user@server:repositories/project.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'user@server:repositories/project.git'

Why I can not push project file.txt to GIT server? Do I have to change some permissions on server? Or what I did wrong?

Thanks for any advice.

martin
  • 101
  • 2
  • 8
  • your issue is definitely this piece: `git push origin master:refs/heads/master` try `git push --set-upstream origin master` – ddavison Feb 12 '14 at 23:46
  • possible duplicate of [gitolite push error -> remote: ENV GL\_RC not set](http://stackoverflow.com/questions/5233058/gitolite-push-error-remote-env-gl-rc-not-set) – John Szakmeister Feb 12 '14 at 23:46
  • @sircapsalot `git push --set-upstream origin master` does not help. Still the same error :-( – martin Feb 13 '14 at 09:49

2 Answers2

1

I dealt with this error while trying to upload to Bitbucket.org. I had to first add my SSH key.

Although you're running your own Git server this might help.

I ran git push -u origin master #The -u flag tells Git what branch you're pushing to for the first time.

If that doesn't work, you might have to try to do a pull first and then push.

Newbi3
  • 356
  • 1
  • 8
  • Yes I have my own git server (gitolite on debian). My SSH key is locaten on server /home/user/.ssh/user.pub and also in /srv/gitolite/.gitolite/keydir/user.pub I got the same error when I used `git push -u origin master`. I can not use the pull command. Do I something wrong? `$ git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull If you wish to set tracking information for this branch you can do so with: git branch --set-upstream master origin/` – martin Feb 13 '14 at 09:39
0

There is a missing puzzle I did not find in any tutorials about gitolite: Note that gitolite repositories are always access as the “gitolite” user. gitolite will recognise your actual user via your SSH key and use the appropriate permissions.

I can not use:

git remote add origin user@server:repositories/project.git

but I have to use login name gitolite (common for all accounts)

git remote add origin gitolite@server:repositories/project.git
martin
  • 101
  • 2
  • 8