Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
设置SSH后Github权限被拒绝(公钥)_Git_Github_Ssh_Terminal_Gitlab - Fatal编程技术网

设置SSH后Github权限被拒绝(公钥)

设置SSH后Github权限被拒绝(公钥),git,github,ssh,terminal,gitlab,Git,Github,Ssh,Terminal,Gitlab,我试图将我的Gitlab存储库转移到Github,但当我尝试向上推它时(根据各种指南),我总是会得到错误:权限被拒绝(publickey)。 我已经阅读了Github教程,在本地向我的Github帐户添加SSH密钥,但是仍然不起作用。下面是一些不同命令的输出 (我已经执行了keygen命令) $eval“$(ssh代理-s)” 代理pid 84168 $ssh add-l-E md5 代理没有身份。 $ssh add~/.ssh/id\u rsa 输入/Users/isiahmayerchak/

我试图将我的Gitlab存储库转移到Github,但当我尝试向上推它时(根据各种指南),我总是会得到错误:
权限被拒绝(publickey)。

我已经阅读了Github教程,在本地向我的Github帐户添加SSH密钥,但是仍然不起作用。下面是一些不同命令的输出

(我已经执行了keygen命令)

$eval“$(ssh代理-s)”
代理pid 84168
$ssh add-l-E md5
代理没有身份。
$ssh add~/.ssh/id\u rsa
输入/Users/isiahmayerchak/.ssh/id\u rsa的密码短语:
添加的标识:/Users/isaahmayerchak/.ssh/id\u rsa(/Users/isaahmayerchak/.ssh/id\u rsa)
$ssh add-l-E md5
4096 MD5:0c:44:3d:28:de:17:71:e5:29:18:bf:a1:8c:8j:mf:3c/Users/isiahmayerchak/.ssh/id_rsa(rsa)
$ssh-vTgit@github.com
OpenSSH_6.9p1,LibreSSL 2.1.8
debug1:正在读取配置数据/Users/isiahmayerchak/.ssh/config
debug1:/Users/isiahmayerchak/.ssh/config第1行:应用*
debug1:读取配置数据/etc/ssh/ssh\u config
debug1:/etc/ssh/ssh\u配置第21行:应用*
debug1:连接到github.com[192.30.253.113]端口22。
debug1:已建立连接。
debug1:identity file/Users/isiahmayerchak/.ssh/id\u rsa类型1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/isiahmayerchak/.ssh/id\u rsa-cert类型-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/isiahmayerchak/.ssh/id_dsa type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/isiahmayerchak/.ssh/id_dsa-cert type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/isiahmayerchak/.ssh/id_ecdsa type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/isiahmayerchak/.ssh/id_ecdsa-cert type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/isiahmayerchak/.ssh/id_ed25519 type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/isiahmayerchak/.ssh/id_ed25519-cert type-1
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_6.9
debug1:远程协议版本2.0,远程软件版本libssh-0.7.0
debug1:不匹配:libssh-0.7.0
debug1:正在以“git”身份向github.com:22进行身份验证
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:server->client chacha20-poly1305@openssh.com没有一个
debug1:kex:client->server chacha20-poly1305@openssh.com没有一个
debug1:需要SSH2\u MSG\u KEX\u ECDH\u回复
debug1:服务器主机密钥:ssh rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1:主机“github.com”已知并与RSA主机密钥匹配。
debug1:在/Users/isiahmayerchak/.ssh/known_hosts:9中找到密钥
debug1:SSH2\u MSG\u已发送新密钥
debug1:应为SSH2\u MSG\u NEWKEYS
debug1:SSH2\u MSG\u接收到新密钥
debug1:服务器不允许漫游
debug1:SSH2\u消息\u服务\u请求已发送
debug1:SSH2\u消息\u服务\u接收
debug1:可以继续的身份验证:公钥
debug1:下一个身份验证方法:公钥
debug1:提供RSA公钥:/Users/isiahmayerchak/.ssh/id\u RSA
debug1:可以继续的身份验证:公钥
debug1:正在尝试私钥:/Users/isiahmayerchak/.ssh/id\u dsa
debug1:正在尝试私钥:/Users/isiahmayerchak/.ssh/id\u ecdsa
debug1:正在尝试私钥:/Users/isiahmayerchak/.ssh/id_ed25519
debug1:不再尝试验证方法。
权限被拒绝(公钥)。
在Github上,我添加的SSH密钥与我的本地密钥完全匹配,但在Github上,它说它还没有被使用

我已经为我的用户名和电子邮件设置了github配置。我还尝试了
ssh-I~/.ssh/id\u rsa-vTgit@github.com

但这对我也没有任何好处。我真的需要在接下来的两天内转移此存储库以进行工作。我所看到的故障排除文章都没有帮助;他们都假设
ssh-vTgit@github.com
将在他们的步骤之后工作,但对我来说不起作用。有人能帮我吗?

将您的本地机器ssh密钥手动添加到github配置文件中

cat ~/.ssh/id_rsa.pub

复制上述命令的输出并将其粘贴到“Github->Settings->SSH和GPG-Key->New-SSH-Key”。

我在Mint Linux 19上遇到了类似的问题,尽管细节与您的不完全相同,但我想与他人分享我的经验:

运行ssh keygen后,通过html将我的密钥添加到我的github帐户,并通过以下方式成功连接到github:

 ssh -vT git@github.com
然后,当我尝试使用以下语法通过ssh克隆存储库时,遇到了权限被拒绝的错误:

git clone ssh://USERNAME@github.com/USERNAME/REPOSITORY
截至2020年7月3日,我尝试了关于这个问题的评论中的所有解决方案,但没有任何帮助。然后我去了github发现

这告诉我:

始终使用“git”用户

所有连接,包括远程URL的连接,都必须作为 “git”用户。如果您尝试使用GitHub用户名连接,它将 失败:

$ssh-tgithub-USERNAME@github.com

权限被拒绝(公钥)

如果您的连接失败,并且您正在将远程URL用于 GitHub用户名,您可以更改远程URL以使用“git”用户

遵循此指令后,我通过SSH连接,没有错误

适用于我的语法是:

git clone ssh://git@github.com/USERNAME/REPOSITORY

你可以尝试手动添加吗?你添加了密钥还是指纹?我不确定指纹是什么,但我已经手动将密钥添加到Github(我添加密钥的唯一方式是手动),这是我最初将密钥放入Github的方式;它已经存在了。赛亚:你能删除现有的密钥并再次尝试添加它吗?我已经尝试了3次,包括生成一个新密钥。我比较了两者,它们是相同的。您是如何生成新的?.ssh-keygen-t rsa-b4096-C“我的电子邮件”的-address@example.c
git clone ssh://git@github.com/USERNAME/REPOSITORY