Loc*_*kna 11 github repository intellij-idea permission-denied gitlab
我是 Git 和 GitHub/GitLab 的新手。我尝试将我的项目共享到 GitHub,但它引发了此异常:
Can't finish GitHub sharing process
Successfully created project 'LiveGame1' on GitHub, but initial push failed:
git@github.com: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我也可以通过互联网链接克隆存储库,但不能通过“git@github.com:/username/repository_name”。
我该如何修复这个错误,我能否将我的项目直接分享到 GitLab?
这篇文章帮助我整理了我的 Windows 10 盒子上的东西:
https://richardballard.co.uk/ssh-keys-on-windows-10/
注意:文章的第一部分应标题为“在 Windows 中启用 SSH客户端”,应指的是启用SSH客户端,而不是服务器。
如果您可以ssh -T git@github.com在不提示您输入密码的情况下开始工作,如上述文章所述,那么您将能够从 IntelliJ 推送就好了。
关键是:
ssh-add被调用的是在C:\Windows\System32\OpenSSHgit config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"
生成密钥时,请ssh-keygen考虑使用此处所述的 ecdsa 算法:https : //www.ssh.com/ssh/keygen/
同样重要的是清理任何其他试图在窗口外执行 ssh 的东西(比如 Putty)。我在尝试运行时一直面临“格式无效”的一个问题,ssh-add我认为是由ssh-add我的路径上正在使用的不同程序引起的,而不是由 Windows 附带的 OpenSSH 程序引起的。
这里有很多建议\n如何解决使用 Git 时的权限被拒绝(公钥)错误?\n这里\n在写入我要拉取的文件时,Git 给出了 \xe2\x80\x9cPermission Denied\xe2\x80\x9d 错误,具体取决于操作系统。
\n对于我在 Windows 上的 IntelliJ 解决方案,这里提到的解决方案是:\n Can\t access git using SSH keys。
\n我在 git 安装中编辑了ssh_config文件,IntelliJ 将其与源主机一起使用并且一切正常。
\n文件例如:
\n\n\nC:\\Program Files\\Git\\etc\\ssh\\ssh_config
\n
在文件内进行更改,例如:
\nHost bitbucket.org\n IdentityFile C:\\Users\\User\\.ssh\\id_ssh\nRun Code Online (Sandbox Code Playgroud)\n编辑:正如评论中提到的(对于 Linux),在 Windows 上也可以在您的 lokal 用户主目录中添加一个配置文件:C:\\Users\\<USER>\\.ssh\\config使用上面提到的主机名。如果您正在使用多个 git 安装或无法访问(由于缺少管理员权限)您的 git 安装,这可能是更好的解决方案。
小智 5
我遇到了同样的问题,我在 github 帐户中为 intelliJ 生成了公钥。
设置 -> 开发者设置 -> 个人访问令牌
然后通过提供必要的范围和描述为 intelliJ 生成一个新令牌。并复制令牌 key。
然后在 intelliJ 中选择 Login via token access .Login通过在显示的表单中粘贴密钥来登录。
谢谢
这个问题太宽泛了。需要更多细节来澄清。
运行git remote show -n origin(假设您在分支上origin。flag-n表示“不查询远程”,这会减少 Web 请求的运行时间。),您可能会看到远程 URL。
在许多常见情况下,例如在 GitHub 上,Git URL采用 HTTPS 协议
https://github.com/<user>/<repo>.git
Run Code Online (Sandbox Code Playgroud)
或 SSH 协议
git@github.com:<user>/<repo>.git
Run Code Online (Sandbox Code Playgroud)
如果该领域user不是您或您的组织之一,那么您似乎试图为某人的存储库做出贡献。请分叉并创建拉取请求来执行此操作。您可能需要使用命令更改本地存储库的远程 url
git remote set-url <branch> <newurl>
Run Code Online (Sandbox Code Playgroud)
如果user是您,请检查您是否正确输入了令牌。
ssh -T git@github.com。更新1:您的问题中似乎有一个拼写错误。注意第一个斜杠。我不确定它是否会带来麻烦。git@github.com:/username/repository_name
更新 2:检查保存在 IntelliJ IDEA 中的Git凭据File -> Settings -> Version Control -> GitHub
更新3:您也可以将其共享到GitLab,只需添加一个远程,例如 run command git remote add gitlab <url>。
| 归档时间: |
|
| 查看次数: |
17375 次 |
| 最近记录: |