SSH - 创建的用户的权限被拒绝(公钥)

SSH - Permission denied (publickey) for created user

我可以使用 ssh 连接到 digitalocean 服务器:

ssh root@1.1.1.1(IP 地址正确)

但是,添加用户后:

adduser git
...
is this information correct?
Y
...

我无法与这个新用户进行 SSH

ssh git@1.1.1.1
Permission denied (publickey).

为什么我的 public 密钥对 root 正确但对 git 不正确?

更新

如果重要的话,我正在使用 digitalocean。

我知道问题所在,你面临的问题,你需要检查你的密钥的权限。 更改用户权限。我确实有一个相同的问题,我可以通过 https 而不是通过 ssh 克隆 git。

chmod 实用程序将解决您的问题:

这个命令可以解决你的问题。

chmod 777 <id_rsa_key(file)>

其他一些常用示例是:

777 anyone can do anything (read, write, or execute)
755 you can do anything; others can only read and execute
711 you can do anything; others can only execute
644 you can read and write; others can only read