A place where the Joyent community can gather, help each other out, and stay informed.
You are not logged in.
Hi
I am hoping someone could point me in the right direction or perhaps suggest a better solution.
I was having trouble pushing my local git repository to my repos hosted on my git accelerator until I resorted to a "temporary" fix after much googling and as far as I know this issue has not come up on Joyent forums either.
I added the server as a remote location and pushed:
git remote add origin ssh://me@my_joyent_box/repos/playground.git
git push origin master
the error is as follows:
hooks/update: syntax error at line 40: `allowunannotated=$' unexpected
error: hooks/update exited with error code 2
error: hook declined to update refs/heads/master
As far as I can tell this is caused by the update hook script using /bin/sh and barfing when using the $() call.
I couldn't really get anywhere reading about the different shells and none of the general suggested solutions worked.
So I decided to replace /bin/sh with /bin/bash in the hook shell scripts like so:
cd playground.git
perl -e "s/\/bin\/sh/\/bin\/bash/g;" -pi $(find hooks -type f)
cd /opt/local/share/git-core/templates
perl -e "s/\/bin\/sh/\/bin\/bash/g;" -pi $(find hooks -type f)
It all works groovy now, but somehow this has left me with the feeling like it isn't really the "right" solution.
For reference:
I compiled git like so:
cd git-1.5.5.4/
./configure --prefix=/opt/local
sudo gmake AR=gar NO_ICONV=1 NO_TCLTK=1 SHELL_PATH=/usr/bin/bash CFLAGS="-Wall -O2 -I/opt/csw/include" LDFLAGS="-L/opt/csw/lib"
Last edited by gk (2008-06-19 11:43:17)
Offline
1.5.6 is just out and may have some fix?
Other than that, have you tried using the git protocol, as opposed to ssh?
Offline
chrispoole wrote:
1.5.6 is just out and may have some fix?
Other than that, have you tried using the git protocol, as opposed to ssh?
thnx for the reply.
the problem will remain even with higher versions as the hook scripts use #!/bin/sh(which is correct and works on all other OSes I have tested). I use both ssh(push) and git(pull) protocol but the afore mentioned problem still occurs due to the hook being executed after a push. This is my assumption but it seems Solaris(my accelerator at least) is using what seems to be a Bourne Shell as /bin/sh.
I suppose if /bin/sh was symlinked to bash I wouldn't have these problems, but that solution under Solaris is quite dangerous based on what is being said on the net.
I don't suffer this issue under my OSX or Ubuntu(which uses dash as /bin/sh).
Last edited by gk (2008-06-19 13:02:43)
Offline
This is happening to me when I create a new git repo with git init --bare and then try to push to it. It's happening on two different shared Accelerators. No problems when I try the exact same process on a dedicated Accelerator.
Offline
I ran across thie problem a few days ago (I'm on a Shared Accelerator). Comparing older git repositories on that SA with ones that have just been created shows that in the older ones, none of the hooks were turned on (chmod +x). On the new repositories, all of the hooks are chmod +x, so the hooks are trying to execute and are running across the error above. The solution for me was to just chmod -x ~/git/*/hooks/*.
Offline
I am also getting this on drake (shared accelerator). Your solution will work but the script given in the wiki explicitly enables one of the hooks:
http://wiki.joyent.com/shared:kb:git
It says:
# Make the repository accessible over http
chmod +x "$1/hooks/post-update"
I think that script could use something like the following command in there as well:
I don't know why this hook didn't need the script changed to /bin/bash. I've done commits and pushes since then without any errors. Perhaps it only gets run the first time...
Offline
I had the same problem as gk. I was getting the same errors when uploading a local git repository:
hooks/update: syntax error at line 40: `allowunannotated=$' unexpected
etc.
The fix was to NOT use the convenience script at the bottom of the "Git on Shared Accelerators" wiki page, as I had used initially, but rather to setup the repository on the server by hand and do the chmod +x, etc. by hand. Then everything worked just fine.
Offline
This problem of hooks being pre-enabled on init is fixed in the 2009Q1 package set (for Accelerators). We'll fix it with the next maintenance on Shared Accelerators. We're also working around the fact that the Git developers use /bin/sh as the interpreter in these, but assume it's a Korn or Bash shell in their code in fact (whereas /bin/sh denotes a Bourne shell).
Offline
Just ran into same exact problem on Donahue... Thanks Andy!
Offline