Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-receive-pack: command not found

Tags:

git

ssh

I'm trying to use Git to push to my remote server, but it keeps saying

git-receive-pack: command not found.

I tried searching and some people say it's the server, others say it's the client.

OS: Windows 8 64bit
Server: Cent OS with CPanel the newest version

Git is built in to CPanel, I didn't install it.

Screenshot

Maybe if I knew which system was saying the error I could troubleshoot it better. Also, I know nothing about SSH. I tried inserting the SSH key that was generated by GIT but when I tried using SSH:// it would still just ask for the password. So something might not be setup correctly. I added the git user to the system with the repository like the git instructions said to do, but I added a password to the user just to see if it would let me login without SSH.

like image 714
user3396392 Avatar asked Mar 08 '14 15:03

user3396392


People also ask

What is invoked by Git send-pack?

Invoked by git send-pack and updates the repository with the information fed from the remote end. This command is usually not invoked directly by the end user. The UI for the protocol is on the git send-pack side, and the program pair is meant to be used to push updates to remote repository. For pull operations, see git-fetch-pack [1].

Why doesn't Git-receive-pack work on 64-bit install?

But if you have installed git using a 64-bit installer the path is different: notice the sub path "mingw64". Basically the problem is that 'git-receive-pack' is not in the default $PATH on the remote end. If that solves the problem, you will be better off adding that path in your user environment variables (see this superuser question for instance)

What does the Git-receive-pack Command do?

The command allows for creation and fast-forwarding of sha1 refs (heads/tags) on the remote end (strictly speaking, it is the local end git-receive-pack runs, but to the user who is sitting at the send-pack end, it is updating the remote. Confused?)

Where does receive-Pack store objects when push fails?

When receive-pack takes in objects, they are placed into a temporary "quarantine" directory within the $GIT_DIR/objects directory and migrated into the main object store only after the pre-receive hook has completed. If the push fails before then, the temporary directory is removed entirely.


2 Answers

The real answer is that even though I put

alias git-receive-pack="/usr/local/cpanel/3rdparty/bin/git-receive-pack"

I still need to add it to my ~/.bashrc

export PATH=$PATH:"/usr/local/cpanel/3rdparty/bin"

Also, on a side note the whole stdin: is not a TTY error can be fixed by removing the /home/git/.bashrc file.

As stated in: http://webhostingneeds.com/Git_stdin_is_not_a_tty

like image 24
user3396392 Avatar answered Oct 06 '22 01:10

user3396392


When you run git push the send-pack part of the protocol is running on your, local side, and it connects to the receive-pack part running on the remote side.

So let's say you run git push, where your remote origin repo is configured to use ssh and is mapped to server.com. Git uses send-pack to initiate a connection over ssh to the server extracted from the remote URL *:

$ ssh server.com "git-receive-pack /path/to/repo.git"

* When the repository was previously cloned or added as git remote add origin ssh://server.com/path/to/repo.git

Note that the quoted command is run by ssh on the remote server, and it is possible that git-receive-pack could not be located there. You can test for this yourself as follows:

$ ssh server.com "type -p git-receive-pack" || echo "git-receive-pack not found"

If indeed the git-receive-pack command could not be located on the remote - for instance, because it is not in the PATH of your remote login shell, you can tell git push where it should look for it by running:

$ git push --receive-pack=/server/com/full/path/to/git-receive-pack

And you can save typing that every time you push by telling git to remember to use the explicit path via the config:

$ git config remote.origin.receivepack /server/explicit/path/to/git-receive-pack
like image 156
mockinterface Avatar answered Oct 05 '22 23:10

mockinterface