Setup git on an Internal Server [Ubuntu]

Posted on

Setup git on an Internal Server [Ubuntu] – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, ubuntu, git, , .

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==
windows.user@email.com

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?

Solution :

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

Leave a Reply

Your email address will not be published. Required fields are marked *