can't git clone with SSH
Asked by hayato_nasu:

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

<br />

git did not exit cleanly (exit code 128) (1313 ms @ 2022/03/28 14:32:58)"

I get an error like this and can't clone.


Answers:
author: Theodora Boudale
body: Hi [@hayato_nasu](/t5/user/viewprofilepage/user-id/4841958) and welcome to the community.

I would like to ask a few questions so we can better help you:

**1.** Is the repo you are trying to clone hosted in Bitbucket Cloud (<https://bitbucket.org/>) or in Bitbucket Server (self-hosted instance)?

**2.** Are you cloning from a terminal application or from a Git GUI client?

**3.** What is the version of Git on this machine and also the operating system?

4. Are you able to clone any other Bitbucket repo you have access to or do you get the same error when cloning other Bitbucket repos as well? (This is to narrow down if the problem seems to be repo specific or not)

**5.** Could you please try cloning with the following command and attach the full output here?

```
GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git clone <repo-url-here>
```

This command should give more verbose output. Please make sure to remove any private/sensitive data from the output prior to sharing.

Kind regards,  
Theodora

comments: author: hayato_nasu
body: Hi Theodora-san

Thank you for support.

I answer the questions.

1.I am trying to clone host in **Bitbucket Cloud.**

2.I am cloning from Git GUI client.

3.The version of Git is 2.8.0.

4.I get the same error with clones of other bitbucket repositories.

5.I don't know how to check this.  
When I try to clone the repository I want to clone, I get the following error:

fatal: Could not read from remote repository.

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

<br />

git did not exit cleanly (exit code 128) (1750 ms @ 2022/03/31 10:02:23)

Thank you.


author: Theodora Boudale
body: Hi [@hayato_nasu](/t5/user/viewprofilepage/user-id/4841958),

Thank you for the info.

* Which Git GUI client are you using?
* Is this Git client using OpenSSH, PuTTY - Pageant or a different SSH client?
* What is the operating system on your machine?

<br />

My suggestions would be:

**1.** First, upgrade Git on your machine to the latest version

**2.** Then, navigate to the **\~/.ssh** directory on your machine. Create there a file named **config** and add the following in the file (if the file already exists, just add the following lines):

```
Host bitbucket.org
        HostName bitbucket.org
        PreferredAuthentications publickey
        IdentityFile /Users/myUser/.ssh/id_rsa
```

Replace **/Users/myUser/.ssh/id_rsa** with the path to the private SSH key you are using for Bitbucket

**3.** Afterwards, use a command line application to clone a Bitbucket repository via SSH (e.g. the Terminal application in Linux/MacOS, or if you're on Windows you can use Git Bash).

Please let me know if this succeeds or fails  
(this is to narrow down whether the problem is specific to the Git GUI client or not).

**4.** If the clone still fails, please clone again from the same command line application using the following command and attach the full output here (after removing any sensitive data from the output)

```
GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git clone <repo-url-here>
```

Replace \<repo-url-here\> with the SSH URL of your repo.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora


Tags: bitbucket-cloud