2016-06-11 69 views
-2

git和Github的新手。一位作者在一个问题讨论中建议我提出拉取请求。我在自己的机器上克隆他的回购with the recommended HTTPS link(而不是另一个Github回购),并进行了我的编辑。现在我试图产生一个拉请求,但我不知道如何。我发现的解决方案并没有帮助。下面是我的Bash git命令的输出。github通过SSH和HTTPS拒绝推送权限

[email protected] 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 

[email protected] ODKWK52 /c/websites/github/repo (master) 
$ git remote -v 
origin ssh://[email protected]/repo.git (fetch) 
origin ssh://[email protected]/repo.git (push) 

[email protected] ODKWK52 /c/websites/github/repo (master) 
$ ssh -T [email protected] 
Permission denied (publickey). 

[email protected] ODKWK52 /c/websites/github/repo (master) 
$ eval "$(ssh-agent -s)" 
Agent pid 7180 

[email protected] 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) 

[email protected] ODKWK52 /c/websites/github/repo (master) 
$ ssh -T [email protected] 
Hi GithubUser! You've successfully authenticated, 
    but GitHub does not provide shell access. 

[email protected] 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. 

[email protected] ODKWK52 /c/websites/github/repo (master) 
$ git remote set-url origin https://[email protected]/repo.git 

[email protected] ODKWK52 /c/websites/github/repo (master) 
$ git push --dry-run origin master 
Password for 'https://[email protected]': 
remote: Permission to repo.git denied to GithubUser. 
fatal: unable to access 'https://[email protected]/repo.git/': 
    The requested URL returned error: 403 

这个错误似乎解决on this official page但信息没有帮助,因为我的SSH密钥从未在其他地方使用的(我产生它只是做到这一点推动),也因为故障发生在两个HTTPS和SSH。正如你所看到的,SSH测试运行成功,所以我不知道为什么我遇到了这个错误。

再次,这不是我的Github回购。作者建议我提出拉请求,我想知道如何做到这一点。我必须将该项目克隆到另一个Github仓库中并推送给它? (I saw that recommendation here)我不明白为什么这是必要的。

回答

1

为了打开拉取请求,您需要“分叉”回购。您可以从GitHub网页界面执行此操作。

一旦你创建了一个叉,你可以将其添加为一个远程为您的本地克隆:

$ 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/