Forums

Trouble with git push

Hi there,

I've been following the instructions here to try and get git push deploys working.

However, when I do a push I get:

ssh: connect to host ssh.pythonanywhere.com port 22: Bad file number
fatal: Could not read from remote repository.

Any ideas?

What do you get if you just try to ssh to the server? That is, if you run

ssh -v jaybob@ssh.pythonanywhere.com

...? You should get a ton of debugging stuff, then a prompt for your password -- use the one you use to log in to the PythonAnywhere website, and see if you get a bash prompt. If you post the full output of the command here, that might help us debug. (Send it via a "Send feedback" message if you're worried about it containing anything you don't want to make public.)

Having tried this from my house and having no issues, I'm putting this down to the firewall in my office.

However, the post receive hook isn't working. I've added:

1
2
3
#!/bin/bash
mkdir -p /var/www/sites/mysite
GIT_WORK_TREE=/var/www/sites/mysite git checkout -f

But it isn't creating anything (i've chmod'ed the file too). Is that still the correct way of doing this? Or should it be at ~/mysite ?

That's a bare repo. It doesn't have a checkout of the site, but it should have a .git directory in it. Also, the post-receive hook file needs to be executable.