github - IntelliJ,无法在 GitHub 上共享项目(权限被拒绝)

标签 github intellij-idea repository gitlab permission-denied

我是 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.

我还可以通过互联网链接克隆存储库,但不能通过“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 进行推送了。

关键是:

  • 获取在 Windows 中运行的 OpenSSH 身份验证代理服务
  • 确保调用的ssh-addC:\Windows\System32\OpenSSH中提供的
  • 确保 git 也配置为使用 Windows 提供的 ssh:

git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"

使用ssh-keygen生成 key 时,请考虑使用ecdsa算法,如下所述:https://www.ssh.com/ssh/keygen/

同样重要的是清理任何其他试图在 Windows 之外执行 ssh 的内容(例如 Putty)。在尝试运行 ssh-add 时,我一直面临“无效格式”的一个问题,我相信这是由我的路径上正在使用的不同的 ssh-add 程序引起的与 Windows 附带的 OpenSSH 相比。

关于github - IntelliJ,无法在 GitHub 上共享项目(权限被拒绝),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54038611/

相关文章:

git - 将本地仓库与 Github 项目 merge

git - 推送 merge 冲突分支

github - 在 github 存储库描述字段中使用图标

java - 如何使用IDEA在tomcat中部署web应用

C#:如何在 API Controller 级别应用序列化来获取某些列

java - 是否有一个基于 hibernate 构建的简单、可扩展的 CRUD 存储库?

git - 如何在 GitHub 上获取其他人的分支上的分支?

shell - Github 错误 : Failed to connect to 443 port

java - 添加 servlet 或过滤器时,web.xml intellij 不会自动完成

java - IntelliJ IDEA 可以显示像eclipse 这样的maven 项目吗?