git和Github的新手。一位作者在问题讨论中建议我提出拉取请求。我在我的个人机器上克隆了他的回购with the recommended HTTPS link(而不是另一个Github回购)并进行了我的编辑。现在我正在尝试生成拉取请求,但我不确定如何。我发现环顾四周的解决方案并没有帮助。下面是我的Bash git命令的输出。
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ git remote -v
origin ssh://git@github.com/repo.git (fetch)
origin ssh://git@github.com/repo.git (push)
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ ssh -T git@github.com
Permission denied (publickey).
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ eval "$(ssh-agent -s)"
Agent pid 7180
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ ssh-add ~/.ssh/id_rsa_github
Identity added: /c/Users/User/.ssh/id_rsa_github
(/c/Users/User/.ssh/id_rsa_github)
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ ssh -T git@github.com
Hi GithubUser! You've successfully authenticated,
but GitHub does not provide shell access.
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ git push --dry-run origin master
ERROR: Permission to repo.git denied to GithubUser.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ git remote set-url origin https://GithubUser@github.com/repo.git
User@MachineName ODKWK52 /c/websites/github/repo (master)
$ git push --dry-run origin master
Password for 'https://GithubUser@github.com':
remote: Permission to repo.git denied to GithubUser.
fatal: unable to access 'https://GithubUser@github.com/repo.git/':
The requested URL returned error: 403
这个错误似乎得到了解决on this official page,但是那里的信息没有用,因为我的SSH密钥从未在别处使用过(我生成它只是为了执行此操作)并且因为失败发生在HTTPS和SSH。如您所见,SSH测试成功运行,因此我不确定为什么会遇到此错误。
同样,这不是我的Github回购。作者建议我提出拉取请求,我想知道如何做到这一点。我必须将项目克隆到另一个Github仓库并推送到它吗? (I saw that recommendation here)我不明白为什么那是必要的。
答案 0 :(得分:1)
为了打开拉取请求,您需要“分叉”回购。您可以从GitHub Web界面执行此操作。
创建分支后,可以将其添加为本地克隆的远程分支:
$ git remote add my-fork <uri-for-my-fork>
然后你可以将你的分支推到你的分支:
$ git push my-fork my-feature-branch
然后,您将能够使用Web界面从原始仓库上的分支机构创建拉动请求。
GitHub在此处提供了详细的文档:https://help.github.com/articles/using-pull-requests/