I'm new to Ubuntu.

I've been following this Setting Up the Server to config git on a Ubuntu machine (MyUbuntu). I created a Git account and my authorized_key is in /Home/git/.ssh

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnXr1ZbTR/l0xlF7dbwiVUH2rf47ht2cHBCAoYigW1iSRk3DUDIp0xZDyaMfJTi3USYXrh3wODjI+U+D3eE9YXCXBDWn7k1tQFQp7QrEpgJgWhWerbLML7IV/JNEBb2k+5dIh5KyEl13r0Umf2ZPWRhUY/tN4vT1lfjy62KKDemYNqr2zxEm/neMvL4jIY4f2uEndGuO7hgsTvXqyjvbqWHDOY3Eeprevo+4iPG8p+g+JTkNQRlcHaL61a8FOwbDbA0xrNWgiHSIQaBDH+tK3xzqLwRjhcQPnwu/0AZ2u7/1EQ+ntaGWJX+zgRR3+kFzadL8wkgBRtCHUrmximHRTvw== [email protected]

The key is generated from a windows pc (MyWindows), and the two machines are connected in a local network (can ping each other).

I've created a git repo in /opt/git/project.git in myubuntu. I tried to create a branch on mywindows and push to myubuntu

git remote add origin git@myubuntu:/opt/git/project.git

git push origin master

But the error msg it gave me is

ssh:connect to host myubuntu port 22: Bad file number

fatal: Could not read from remote repository.

Did I miss any setup steps, what about folder permission of repo on myubuntu or missing some ssh setup?

  • 4
    Are you able to login to your Linux box using putty with that key? Are the permissions setup so that the git account has read/write access to /opt/git/project.git? Do you see any activity in your /var/log/auth.log when you try to do a push?
    – Zoredache
    Apr 25, 2013 at 0:09

1 Answer 1


This is definitely a connection problem, not a problem with directory permissions. The ssh-service on port 22 of the Ubuntu host is not reachable. Either ssh is not running or port 22 is blocked by a firewall.

On your Ubuntu machine, make sure sshd is running on port 22:

sudo netstat -tlnp|grep :22

and check that there are no firewall rules in place that block the connection:

sudo iptables -nL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .