HTTP 403 on GitHub pull request

主宰稳场 提交于 2020-04-10 21:06:55

问题


I want to submit my first (ever) GitHub pull request and am running into some difficulty doing so.

According to this article I must first create a branch. So I:

  • git clone https://github.com/theuser/therepo.git
  • git branch mybranch
  • git checkout mybranch
  • Make my changes
  • git commit -a -m "Closes theuser/therepo/#100"

My thinking here (please correct me if it was wrong) was to clone the repo, make the branch and commit changes to that branch.

If I'm reading that article (linked above) correctly, then next thing I need to do is push the branch so that I can move on to Step #2 (In the "Branch" menu, choose the branch that contains your commits.).

So I do a git push and I get:

D:\workspace\therepo>git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

    git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

    git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://github.com': myuser
Password for 'https://myuser@github.com':
remote: Permission to theuser/therepo.git denied to myuser.
fatal: unable to access 'https://github.com/theuser/therepo.git/': The
    requested URL returned error: 403

I can't tell what's going on here? Is the first warning/error (complaining about push.default) causing the second error (HTTP 403), or are they separate? Is my strategy (pushing the branch) wrong? I'm so confused.


回答1:


Those instructions would work if you were a contributor to that project, but you're not. So you need to fork first. Read Fork a Repo. Clone your fork, make the branch there, push and then submit the pull request.

The your repository vs. their repository isn't really spelled out, but if you look start with your article and click the link for creating a branch you end up at Creating and deleting branches within your repository. Emphasis mine.

There's a bit more about the two different collaboration models (Fork & Pull vs. Shared Repository) in Using Pull Requests.



来源:https://stackoverflow.com/questions/29044551/http-403-on-github-pull-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!