GIT SSH access for a team repository fails with "host not found"

Manuel Weinert April 16, 2019

We have set up a team and a repository. We are now trying to access the repository with a public key provided by a remote system.

I added the public key to the repositorys' access keys. The SSH url is like this: ssh://git@bitbucket.org:teamname/my-remote-code.git

Now, when the remote system tries to clone the repository, the process fails. Here are the gradle/git messages:

 

Git stderr: Cloning into '/opt/workspace/build/customer-project'...
Git stderr: ssh: Could not resolve hostname bitbucket.org:teamname: Name or service not known
Git stderr: fatal: Could not read from remote repository.
Git stderr:
Git stderr: Please make sure you have the correct access rights
Git stderr: and the repository exists.

 

I guess the problem might be the ":teamname" in the url which should normally be a TCP port. But I don't know how to get around this issue!

1 answer

0 votes
Craig Castle-Mead
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2019

Hi Manuel,

Yes the : usually indicates a port for HTTP/S/etc, but with git it seems to be different as I can clone a repo that has a similar URL structure (bitbucket.org:teamname/project/repo.git)

Have you confirmed that DNS is working on the machine you're trying to clone from as a first check?

 

If it's a Linux based system, you should be able to prefix your git command with  GIT_CURL_VERBOSE=1 GIT_TRACE=1  for some extra output

So:

GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ssh://git@bitbucket.org:teamname/my-remote-code.git

This may give you the answer you're after, if not, paste it back in here (ensure you remove or **** out anything sensitive like the repo name etc) and the community can have a look too

 

CCM

David Deaderick
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 12, 2019

I have been having issues with the ssh:// prefix to the git ssh "URL". If I omit and just use <host-domain-name>:<path-to-repo> command line git works, but if I use ssh://<host-domain-name>:<path-to-repo> I get a host not found error.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events