使用gitextensions推送到github时出现Git错误

发布于 2024-11-02 18:52:56 字数 570 浏览 1 评论 0原文

我在 github 上创建了一个名为 Documentation 的存储库。我认为创建了一个名为 Doc 的本地存储库。

我将一个名为 origin 的远程文件添加到本地 Doc 存储库,并将其指向正确的 github 读写 URI。添加并在本地提交了一个文件,但是当我尝试推送到原点时,我收到以下错误:

git push -u "origin" master:master
Done
ERROR: Permission to myUsername/Documentation.git denied to myUsername.
fatal: The remote end hung up unexpectedly

I can ssh to [电子邮件受保护] 并收到我登录成功的通知。我似乎无法推送到我的存储库。

我可以将存储库克隆到一个新文件夹中,但如果我尝试添加提交并推送新文件,我会收到相同的错误。

I created a repository on github named Documentation. I think created a local repository named Doc.

I added a remote named origin to the local Doc repository and pointed it to the proper github read-write URI. Added and locally committed a file, but when I attempt to push to origin I receive the following error:

git push -u "origin" master:master
Done
ERROR: Permission to myUsername/Documentation.git denied to myUsername.
fatal: The remote end hung up unexpectedly

I can ssh to [email protected] and receive the notice that I logged in successfully. I just can't seem to push to my repository.

I can clone the repository into a new folder, but if I attempt to add commit and push a new file I get the same error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏别ゝ 2024-11-09 18:52:56

您将在 此 GitHub 支持线程 您需要对此错误执行的所有检查。

这将包括:

  • 设置 git user.name
  • 设置 git user.email
  • 上传 /home/myuser/.ssh/id_rsa.pub 的内容code> 到 github 的帐户页面。
    而不在其中粘贴任何空格。
  • 添加正确的远程源而不输入错误: git remote add origin [email protected] :myuser/myrepo.git
  • 要确认这一点,请检查.git/config.
    该目录是正确的,而不是另一个目录:
    [remote "origin"]
            fetch = +refs/heads/*:refs/remotes/origin/*
            url = [email protected]:myuser/myrepo.git
     Hi myuser! You've successfully authenticated, but GitHub does not provide shell access.
  • 通过查看 -v 的输出来检查代理或防火墙是否拒绝
  • 检查是否提供了密钥:
  • 设置 github 用户名github 令牌:(
    $ git config --global github.user myuser
    $ git config --global github.token 0123456789yourf0123456789token

为系统上的所有 git 实例设置 GitHub 令牌)
- 创建一个~/.ssh/config

    [github]
        token = mytoken...
        user = myuser

You will find in this GitHub support thread all the checks you need to do with this error.

That would include:

  • setup the git user.name
  • setup the git user.email
  • uploaded the contents of /home/myuser/.ssh/id_rsa.pub to github's account page.
    without pasting any whitespace in it.
  • add the proper remote origin without making typos : git remote add origin [email protected]:myuser/myrepo.git
  • to confirm that, check the .git/config.
    The directory is correct and not another directory:
    [remote "origin"]
            fetch = +refs/heads/*:refs/remotes/origin/*
            url = [email protected]:myuser/myrepo.git
  • check that ssh [email protected] -v gives a successful authentication, with the right username (any other username means that another GitHub account is actually used)
     Hi myuser! You've successfully authenticated, but GitHub does not provide shell access.
  • check any denial from a proxy or firewall
  • check that the key is offered, by looking at the output from -v:
  • setup a github username and github token:
    $ git config --global github.user myuser
    $ git config --global github.token 0123456789yourf0123456789token

(Sets the GitHub token for all git instances on the system)
- create a ~/.ssh/config

    [github]
        token = mytoken...
        user = myuser
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文