My webhost has cPanel and I can access Git from /usr/local/cpanel/3rdparty/bin/git. I am on a Windows 7, use Git Bash, PuTTY for my stuff on the server my port to connect is 1900 not 22.
I tried to follow Using Git to manage a web site and want to use my remote to a subdomain.
I managed to setup the git init --bare
on the web-server at home/usrname/public_html/subdomain/subdomain.git
but this was the first stumble:
cat > hooks/post-receive
I looked it up in the FTP and could not find such a file. Reading git-documentation it says that "the file is empty at first", so I created it, wrote
GIT_WORK_TREE=/public_html/subdomain git checkout -f
Later on I tried
GIT_WORK_TREE=/home/usrname/public_html/subdomain git checkout -f
and tried to add the path to Git
GIT_WORK_TREE=/public_html/subdomain /usr/local/cpanel/3rdparty/bin/git checkout -f
Then I fixed the chmod for the file. Then I went to add my remote:
git remote add web ssh://usrname@domain.com:1900/home/public_html/subdomain.git
and run
git push web +master:refs/heads/master
Here I get to insert my password, so the connection is fine. No matter what I do I always end up with the same error message in Git Bash:
usrname@domain.com's password:
stdin: is not a tty
bash: git-receive-pack: command not found
fatal: Could not read from remote repository
Please make sure..... blah blah
I tried to change up my post-receive. I tried to follow Pushing and existing project into bare repo but when I run:
ssh user@ftp.domain.com:1900 which git-receive-pack
I get:
ssh: Could not resolve hostname .... no address associated with name
When I try to ´echo $path´ I get the same error.
I think my problem is that my git add remote
address is wrong. I can't reach the right directory to the repo? I have tried so many different settings, so many different addresses. Same result. I tried ~/public_html/subdomain/subdoimain.git
and home/usr/public_html/subdomain/subdoimain.git
and some other stuff but I cannot get it right.
EDIT: I have looked at this SO post about this error on cpanel servers. Post I have tried to fallow the guide he is fallowing. The first error is when he adds the remote:
git remote add origin username@awesome.com/path/to/repo.git But i have to use git remote add origin with ssh to reach the server and then enter my password.
ssh://username@awesome.com:1900/path/to/repo.git
I have tried to edit the /repo.git/config file like the post mentioned as a solution dont salve anything. I still get this very sad:
stdin: is not a tty
bash: git-receive-pack: command not found
fatal: Could not read from remote repository
Help anyone?