Pushing and existing project into bare repo

I've been working on a project locally using git and laravel. I've finally decided to add a bare repo to our server in order to push the changes and automate deployment.

I'm sure I'm doing something wrong as I'm green to using git. When I do a push I get the following error:

stdin: is not a tty
bash: git-receive-pack: command not found
fatal: Could not read from remote repository

Please make sure you have the correct access rights and the repository exists.

Here's the process I used - keep in mind the project repository was initially cloned from laravel and I created my own master branch and a few pushes exist. I also have all ssh logging setup already.

  1. logged in via ssh
  2. created directory: mkdir public_html.git
  3. changed directory: cd public_html.git
  4. created the repo: git init --bare
  5. added a post-receive hook - which i verified works in a test project
  6. moved back to local machine
  7. added a new remote: git remote add www user@0.0.0.0:public_html.git
  8. made a new branch: git checkout -b develop
  9. attempted to push: git push www

Most of the research from looking into this mentions checking the git/config file, but all of that seems to be correct.

Answers


It looks like git-receive-pack is not on the path for the user configuration used to push to the repository. When you push to a git repository via ssh git will use ssh to execute commands on the remote server under the user account which is doing the push. These commands, such as git-receive-pack, must be available on that user's path on the server. To diagnose this I would start by executing the command

ssh user@0.0.0.0 which git-receive-pack

You will almost certainly get a command not found error. Next you could try

ssh user@0.0.0.0 'echo $path' # Note the single quotes.

This will show you what the user's path is on the remote server and may help you figure out what is wrong. Note the line in the ssh man page:

ssh ... [user@]hostname [command]

...

If command is specified, it is executed on the remote host instead of a login shell.

This can be a subtle but important distinction as it means a login shell to the remote created with ssh user@0.0.0.0 may not see the same shell environment as a command run by ssh user@0.0.0.0 some remote command. This answer has an explanation of how this works for the bash shell, others behave similarly.


Need Your Help

Issues with Jquery ajax call

json jquery-ui jquery user-controls

I'm using jqueryui dialog box to show some details to the user and pass to the codebehind of usercontrol in order to perfrom CRUD operations. However, I'm not having success. Can anyone assist me w...

Better way to find matches in two sorted lists than using for loops? (Java)

java list compare sorted

I have two sorted lists, both in non-decreasing order. For example, I have one sorted linked list with elements [2,3,4,5,6,7...] and the other one with elements [5,6,7,8,9...].