Error Cannot Run Hooks/post-receive
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this cannot spawn .git/hooks/pre-commit: no such file or directory site About Us Learn more about Stack Overflow the company Business Learn
.git/hooks/ No Such File Or Directory
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question git post-receive hook x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Git - remote: error: cannot run hooks/post-receive: No such file or directory up vote 21 down vote favorite 4 I get the error : remote: error: cannot run hooks/post-receive: No such file or directory When trying to push to remote. The post-receivce file exists in the correct location (testnew.git/hooks) and contains: #!/bin/bash2 export GIT_DIR=/var/www/testnew/testnew/.git/ export GIT_WORK_TREE=/var/www/testnew/testnew/ cd /var/www/testnew/testnew/ echo "here we go..." git fetch git merge origin/master git submodule update --init --recursive I've tried setting permissions on post-receive using: chmod a+x post-receive But this gives same error. Setting permission to 755 removes the error , but the script does'nt run. git share|improve this question asked Jul 24 '12 at 12:01 BobFlemming 85543354 1 what happens when you run directly from your shell hooks/post-receive? My guess is that /bin/bash2 does not exist, at least its not an usual interpreter, /bin/bash should be sufficient –jolivier Jul 24 '12 at 12:06 add a comment| 2 Answers 2 active oldest votes up vote 24 down vote accepted This would happen if the hooks/post-receive file exists, is marked executable, but cannot be executed. It cannot be executed, because the interpreter, /bin/bash2, either does not exist or is not executable. Replace the /bin/bash2 with name of bash that does exist and is executable on the server. (The reason the error looks like this is, that the operating system only returns the error status, "No such file or directory", but does not report which file does not exist. And the code that tried to execute it does not know
Sign in Pricing Blog Support Search GitHub This repository Watch 1,020 Star 18,528 Fork 5,074 gitlabhq/gitlabhq Code Issues 155 Pull requests 0 Projects 0 Pulse Graphs New issue "error: cannot run hooks/post-receive: No such file or directory" when i push #331 Closed siuying opened this Issue Jan 25, 2012 · 11 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 5 participants siuying commented http://stackoverflow.com/questions/11630433/git-remote-error-cannot-run-hooks-post-receive-no-such-file-or-directory Jan 25, 2012 After upgrade to gitlab 2.1 from 1.x, whenever i push to server, i receive error message: "error: cannot run hooks/post-receive: No such file or directory" Full messages: Delta compression using up to 4 threads. Compressing objects: 100% (11/11), done. Writing objects: 100% (12/12), 2.08 KiB, done. Total 12 (delta 5), reused https://github.com/gitlabhq/gitlabhq/issues/331 0 (delta 0) error: cannot run hooks/post-receive: No such file or directory To git@server:repo.git 17510e3..1d2e55d master -> master ariejan commented Jan 25, 2012 Did you install redis via apt-get install redis-server? siuying commented Jan 25, 2012 Initially i didn't install redis. I have since install it, open "http://gitlabserver/info/resque/overview" works. It still complain about the post-receive hooks... siuying commented Jan 25, 2012 Thanks, solve this after checking the post-receive. I was not install though apt-get and the app user do not have access to redis-cli. properly setup redis solve the issue. siuying closed this Jan 25, 2012 Mikchel commented Feb 14, 2012 I have the same issue. I built redis from source on Mandriva so what exactly do you mean "properly setup redis solve the issue." siuying commented Feb 14, 2012 @Mikchel properly setup means, the gitlab user should have redis command "redis-cli" in PATH. Check the hook https://github.com/gitlabhq/gitlabhq/blob/master/lib/post-receive-hook, your gitlab user should run it without error. Mikchel commented Feb 14, 2
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow http://askubuntu.com/questions/526537/post-receive-no-such-file-or-directory the company Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top post-receive: No such file or directory no such up vote 2 down vote favorite I'm getting an error when trying to push to a remote Amazon EC2 (Ubuntu Linux) instance. I've given all related directories and files full permissions. I'm trying to use a post-receive hook to move the project to my production directory at /var/www/myapp: $ git push prod-server master Counting objects: 5, done. Delta compression using up to 8 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 292 no such file bytes | 0 bytes/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: error: cannot run hooks/post-receive: No such file or directory To prod-server:/home/ubuntu/myapp/myapp.git 8944048..a445d1d master -> master My post-receive file (located in bare repository: /home/ubuntu/myapp/myapp.git/hooks/): #!/bin/bash while read oldrev newrev ref do branch=`echo $ref | cut -d/ -f3` if [ "prod-server" == "$branch" -o "master" == "$branch" ]; then git --work-tree=/var/www/myapp/ checkout -f $branch echo 'Changes pushed to Amazon EC2 PROD-SERVER directory!' fi if [ "test" == "$branch" ]; then git --work-tree=/var/www/myapp/test/ checkout -f $branch echo 'Changes pushed to Amazon EC2 PROD-SERVER test directory!' fi done bash git amazon-ec2 share|improve this question edited Sep 21 '14 at 3:03 Eliah Kagan 56k15162255 asked Sep 21 '14 at 1:20 TheNally 112 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote It looks like the problem is with the post-receive script not being in the right place. What is the output of git remote -v in the local repository and ls -l /home/ubuntu/myapp/myapp.git/hooks on the server? Some tips for the script itself: Use More Quotes™ Bash (and POSIX shells) use a single equals sign for [ -o is deprecated; you should instead use [ foo = bar ] || [ baz = ban ] Use set -o errexit to exit the script at the first error