Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.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
IntelliJ,无法在GitHub上共享项目(权限被拒绝)_Github_Intellij Idea_Repository_Gitlab_Permission Denied - Fatal编程技术网

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

IntelliJ,无法在GitHub上共享项目(权限被拒绝),github,intellij-idea,repository,gitlab,permission-denied,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

我是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.
我还可以通过internet链接克隆存储库,但不能通过“git@github.com:/username/repository\u name”


如何修复此错误,以及如何将我的项目直接共享给GitLab?

这个问题太广泛了。需要更多的细节来澄清

运行
git remote show-n origin
(假设您位于分支
origin
-n
标志表示“不查询远程”,这减少了web请求的操作时间),您可能会看到远程URL

在许多常见情况下,例如在GitHub上,都使用HTTPS协议

https://github.com/<user>/<repo>.git
git@github.com:<user>/<repo>.git
如果
user
是您,请检查您是否正确输入了令牌

  • 如果您使用的是HTTPS协议,请检查您输入的用户名和密码。你可能需要检查一下
  • 如果您使用的是SSH协议,请确保您的计算机具有相应的SSH密钥。您可以使用命令ssh-T测试连接git@github.com
更新1:您的问题中似乎有输入错误,
git@github.com:/username/repository\u name
。注意第一条斜线。我不确定它是否有问题

更新2:
文件->设置->版本控制->GitHub


更新3:您也可以将其共享到GitLab,只需添加一个远程,例如运行命令
git remote add GitLab

我遇到了同样的问题,我在github帐户中为intelliJ生成了公钥

设置->开发者设置->个人访问令牌

然后通过提供必要的范围和描述为intelliJ生成新的令牌,并复制令牌密钥

之后,在intelliJ中选择通过令牌访问登录。将密钥粘贴到显示的表单中登录


谢谢你这里有很多建议 这里呢 取决于操作系统

对于我来说,在IntelliJ的Windows上,解决方案如下所述:

我在git安装中编辑了ssh\u config-文件,IntelliJ将该文件与源代码主机一起使用,并且所有文件都已运行

文件,例如:

C:\ProgramFiles\Git\etc\ssh\ssh\u config

文件中的更改,例如:

Host bitbucket.org
    IdentityFile C:\Users\User\.ssh\id_ssh

这篇文章帮助我在我的Windows 10设备上解决了问题:

注意:文章的第一部分应标题为“在Windows中启用SSH客户端”,并应提及启用SSH客户端,而不是服务器

如果你能得到
ssh-Tgit@github.com
如上文所述,在不提示您输入密码的情况下工作,您就可以从IntelliJ中推送密码了

关键在于:

  • 获取在Windows中运行的OpenSSH身份验证代理服务
  • 确保调用的
    ssh add
    是在
    C:\Windows\System32\OpenSSH
  • 确保git也配置为使用Windows提供的ssh:
git config--global core.sshCommand“'C:\Windows\System32\OpenSSH\ssh.exe”

在使用<代码> SSH KEGGEN/代码>生成密钥时,考虑使用ECDSA算法,如这里所描述的:


同样重要的是清理试图在windows之外执行ssh的任何其他操作(如Putty)。在尝试运行
ssh add
时,我一直面临一个“无效格式”的问题,我认为这是由于在我的路径上使用了一个不同的
ssh add
程序,而不是Windows附带的OpenSSH程序造成的。

关于WebStorm,我可以分享一个类似的情况和答案

我之前为另一个
SSH
密钥存储了密码,我添加了一个新密钥(不要忘记
SSH-agent-s
,如果在Mac上),但WebStorm没有发现它

WebStorm中没有为即将到来的错误消息提供上下文,遗憾的是,它是来自
git
的通用消息:

Push failed

<project>: git@<domain>: Permission denied (publickey).

Could not read from remote repository.
                    
Please make sure you have the correct access rights
and the repository exists.
然后,将使WebStorm在
git
远程
上拾取,并提示您输入已配置SSH密钥/SSH配置项的密码


(请记住替换上面标有
的占位符)。

我正在使用Windows 10PuTTY身份验证代理(带有密码保护的SSH密钥),这对我来说很有效-对于我上传SSH密钥的Bitbucket和Github帐户

在Intellij中集成“SSH”密钥的步骤-

  • 打开“PuTTYgen”应用程序
  • 单击“文件>加载私钥”
  • 从目录中选择您的.ppk文件
  • 单击“转换>导出OpenSSH密钥”
  • 使用“id\u rsa”名称将文件保存在“C:\Users\(您的用户名)\.ssh”文件夹中
  • 打开Intellij
  • 单击“文件>设置”
  • 展开“版本控制”
  • 展开“Subversion”
  • 点击“SSH”
  • 选择“私钥”单选按钮
  • 选择存储在“C:\Users\(您的用户名)\.ssh”文件夹中的生成文件
  • 单击“确定”按钮
  • 测试配置:单击“VCS>Git>Fetch”。如果“获取成功” 消息显示,您的配置成功


    来源:

    这个存储库是你的吗?我可以克隆每个公共存储库,但我尝试共享我的一个项目,但它抛出了这个例外。我只想知道,用户是否显示在你当前存储库的
    git remote
    url中(可能是HTTPS方式
    https://github.com//.git
    ,或SCP方式
    git@github.com:/.git
    ),您自己或您的组织,或其他人?是的,将新项目添加到github是我的repo和用户名,而
    Push failed
    
    <project>: git@<domain>: Permission denied (publickey).
    
    Could not read from remote repository.
                        
    Please make sure you have the correct access rights
    and the repository exists.
    
    Host <domain>
        User git
        IdentityFile ~/.ssh/<your private SSH key file, usually `id_...`>