How to connect to git remote via ssh on Media Temple Centos?

144 Views Asked by At

I've created a new user on my Centos 7, added a .ssh folder with my public key in authorized_keys. I am able to successfully connect via ssh to the server with that user with

ssh <username>@<ipaddress>

I have also created a bare git repo on the server at:

/var/repo/<reponame>.git

and added a remote on my local machine using:

git remote add origin <username>@<ipaddress>:/var/repo/<reponame>.git

When I run:

git remote show origin

or

git push origin master

It hangs, then gives the response:

ssh: connect to host <ipaddress> port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I'm not sure why I can successfully connect via SSH, but this command fails. Any help you could provide would be absolutely amazing.

1

There are 1 best solutions below

0
On

Check first if your successfull ssh connection comes with outputs from the remote user ~/.profile or ~/.bashrc.

Ideally, it should be silent.

Check also if git is available (in the default system PATH) when you open an interactive SSH session.