progrium / gitreceive

Easily accept and handle arbitrary git pushes
1.14k stars 108 forks source link

Error pushing changes to gitreceive: No script output reported #42

Closed NigelThorne closed 8 years ago

NigelThorne commented 8 years ago

I'm trying to put together a simple "gitreceive" docker service, that when pushed a repo will build the docker image and publish it to a docker repository.

I'm just currently trying to get gitreceive to accept a pushed git repo.

https://github.com/NigelThorne/dockerfiles/tree/master/gitreceive-dockerbuilder

I'm getting the following error..

tzm-mac:xxx nwt$ git push gr master Counting objects: 3, done. Writing objects: 100% (3/3), 208 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To ssh://git@192.168.99.100:34567/xxx ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'ssh://git@192.168.99.100:34567/xxx'

To recreate this...

I build and ran my docker project

docker build -t gitreceive . docker run -p 34567:22 -d --name gitreceive gitreceive

push ssh key to server

chmod 600 sshkey cat ~/.ssh/id_rsa.pub | ssh -i sshkey root@192.168.99.100 -p 34567 "gitreceive upload-key nwt"

Then make a repo

mkdir xxx cd xxx git init . echo test > test.txt git add . git commit -m "initial commit" git remote add gr ssh://git@192.168.99.100:32768/xxx git push gr master

ERROR

Thanks for your time and guidance.

NigelThorne commented 8 years ago

I just found this... http://stackoverflow.com/questions/7986139/git-error-when-trying-to-push-pre-receive-hook-declined

and it fixed it!

git pull --rebase git push gr master Counting objects: 3, done. Writing objects: 100% (3/3), 208 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To git@192.168.99.100:xxx

  • [new branch] master -> master tzm-mac:xxx nwt$

I have no idea why that worked.

NigelThorne commented 8 years ago

I was expecting to see some of the feedback from the receiver script in the output:

echo "Receiving a push.." echo "==> repository: $1" echo "==> revision: $2" echo "==> username: $3" echo "==> fingerprint: $4"

but there was nothing. How do I get this script output to appear in the client?

(there is nothing in docker logs either).

NigelThorne commented 8 years ago

I believe the receiver script was being overwritten by "gitreceive init", so I had to swap the order of a few commands in the docker file. All working as expected now...

Nothing to see here... move along... move along.