关于git的问题,不能push

新手上路,请多包涵

和之前一样,最后一步执行git push origin master,这时候提示失败:
Permission denied (publickey).
fatal: Could not read from remote repository.

然后重新设了ssh秘钥,并且ssh -T git@github.com是可以的,返回:
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.Connection to github.com closed.
但是,git push的时候,总是失败,提示是:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

在网上看到好多答案,比如在 .ssh 文件夹中执行 ssh-add id_rsa,返回是:
Could not open a connection to your authentication agent.
又比如,git/config设置的仓库url地址和github使用的链接地址是否一致(注:这个不明白在哪里执行,就去找到想要push的文件执行了),

cat .git/config,返回是:
[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
    这个返回跟网上看到的返回不一样,不知道怎么改。
    各位大神赐教啊!!!
    
阅读 3.9k
2 个回答

在github的配置页中可以加入你这个主机的公钥。
clipboard.png

如果是别人的项目的话,需要仓库的创建者把你添加到collaborators里面并且赋予你写的权限。

希望能帮助到你~

上面讲的情况好像是缺少写权限,这里还有一个链接,不知道是不是和你的情况相同
https://stackoverflow.com/que...

新手上路,请多包涵
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进