相关文章推荐
开朗的丝瓜  ·  AttributeError: ...·  1 年前    · 

Platform Notice: Cloud, Server, and Data Center - This article applies equally to all platforms .

Summary

When attempting a verbose git SSH operation the error "No such file or directory" can be seen on the debugging logs. This means that either the SSH agent can't locate the SSH keys under the path configured or the keys are in a different path.

Environment

Connecting to Bitbucket over SSH.

Diagnosis

This can be confirmed by running the following command:

debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: <path_to_your_key>:
debug3: no such identity: <path_to_your_key>: No such file or directory

The command will try all the keys listed on your SSH config, so it is normal to see this message several times in a row. If you don't see this message or see a different one, you can refer to Permission denied (publickey) .

Cause


This happens because either the SSH agent is unable to locate the keys (either the path set in the configuration is wrong, or the keys aren't in the correct path).

Solution

One of the below options

  1. Adding the correct key path to your SSH config file. On Linux/MacOS the config file is usually located on "~/.ssh/config". For example, If your key is located at "/Users/testuser/.ssh/keys/myrsakey", the path can be corrected by adding the following line under the host configuration in your config file "~/.ssh/config".

2. Adding the files to the path mentioned on the debug message. To do so simply move the SSH keys to the path mentioned on the debug message shown when running the verbose command.
3. If there are no keys available, add new SSH keys from scratch. You can find detailed steps on how to Set up personal SSH keys on Linux (MacOS and Windows 10 on the side column) .