我正在尝试将我的本地代码推送到我的团队负责人的git分支中,该分支是由他创建的,并且允许写入和读取分支NOT REPO的权限。 所以我想将我的本地代码推入他的分支这是可能的吗?我已经读取了master repo和其他分支的访问权限,我可以读取和写入。
$ git push origin branchname
remote: Unauthorized
fatal: Authentication failed for ' https://aniket@bitbucket.org/teamleader/repo.git/'
答案 0 :(得分:1)
☻ git push origin protected
protected 32adf9f
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 351 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: permission denied to update branch protected
To bitbucket.org:blah/blah.git
! [remote rejected] protected -> protected (pre-receive hook declined)
error: failed to push some refs to 'git@bitbucket.org:blah/blah.git'
根据您问题中的输出,我认为将推送到分支时没有问题,而是所有推送存在身份验证问题。< / p>
用于推送到branchname
的命令(假设这是您具有写访问权限的分支)是正确的。
以下是尝试推送到受保护的github 分支失败的输出。这与当前的问题无关,但我将其留在这里,因为它可能对未来的读者有用
在尝试推送到受保护的Github分支时,输出如下:
☻ git push --set-upstream origin master
Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (11/11), 1.69 KiB | 0 bytes/s, done.
Total 11 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: At least one approved review is required.
To github.com:blah/blah.git
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'git@github.com:blah/blah.git'
更新道歉,我只是注意到你的回购是在bitbucket而不是Github。已经发布了bitbucket的更新输出。