我目前在一个 Scrum 团队工作,该团队与另一个 Scrum 团队使用共享的 git 存储库。为了方便起见,我们将我的 Scrum 团队称为“汽车人”,将另一个团队称为“霸天虎”。
霸天虎团队拥有对存储库的完全推拉访问权限,并负责该框架。
汽车人团队能够拉动,但不能推动。一般来说,如果团队成员独立工作,是没有问题的。然而,在某些情况下,拉动和推送到另一个团队成员分支会很有用。到目前为止,汽车人尚未获得霸天虎的推送访问权限(简单修复),因此需要解决方法。
用例示例:考虑 Optimus(继续变形金刚的比喻)是否已完成以下操作:
#!/bin/bash
optimus@workstation0:~/git/work_project/> git branch sdev /sprint/dev --track
optimus@workstation0:~/git/work_project/> git checkout sdev
optimus@workstation0:~/git/work_project/> touch important_file.py
optimus@workstation0:~/git/work_project/> git add important_file.py
optimus@workstation0:~/git/work_project/> git commit -m "Important file added."
现在,补足 通过编辑来帮助 Optimus important_file.py。他创建了自己的分支并直接从 Optimus 分支中拉取,并尝试推送:
#!/bin/bash
rodimus@workstation1:~/git/work_project/> git branch sdev /sprint/dev --track
rodimus@workstation1:~/git/work_project/> git pull ~optimus/git/work_project sdev
rodimus@workstation1:~/git/work_project/> echo "'''TODO: Add content''' > important_file.py
rodimus@workstation1:~/git/work_project/> git commit -m "Added TODO".
rodimus@workstation1:~/git/work_project/> git push ~optimus/git/work_project sdev
结果发生了错误。正确的程序是什么?不希望有第二个存储库,但如果需要的话可以这样做。
I am currently working for a Scrum Team that is using a shared git repository with another Scrum Team. For ease, we will call my scrum team Autobot and the other Decepticon.
Team Decepticon has full push and pull access to the repository, and are in charge of the framework.
Team Autobot is able to pull, but not to push. Generally there is no issue if members of the team work independently. However, cases arise where it would be useful to pull and push to another team members branch. As of yet, Autobot has not been granted push access by Decepticon (the easy fix) so a work around is required.
A use case example: Consider if Optimus (To continue the transformers metaphor) has done the following:
#!/bin/bash
optimus@workstation0:~/git/work_project/> git branch sdev /sprint/dev --track
optimus@workstation0:~/git/work_project/> git checkout sdev
optimus@workstation0:~/git/work_project/> touch important_file.py
optimus@workstation0:~/git/work_project/> git add important_file.py
optimus@workstation0:~/git/work_project/> git commit -m "Important file added."
Now, Rodimus is to help Optimus by editing important_file.py. He creates his own branch and pulls straight from Optimus's branch, and tries to push:
#!/bin/bash
rodimus@workstation1:~/git/work_project/> git branch sdev /sprint/dev --track
rodimus@workstation1:~/git/work_project/> git pull ~optimus/git/work_project sdev
rodimus@workstation1:~/git/work_project/> echo "'''TODO: Add content''' > important_file.py
rodimus@workstation1:~/git/work_project/> git commit -m "Added TODO".
rodimus@workstation1:~/git/work_project/> git push ~optimus/git/work_project sdev
And errors occur. What is the Proper procedure for this? It is undesirable to have a second repository, but do-able if required.
发布评论
评论(1)
2014 年更新(3 年后)
正如 Adrien Be 在 评论
请参阅“使用分支权限”
原始答案(7 月) 2011)
通常的解决方案是第二个存储库,其中:
但这需要第二个存储库。
另一种解决方案是使用像 Gitolite 这样的授权框架,提供 推送对汽车人分支的访问。
它只需要一个存储库,但需要一台服务器(ssh 或 apache)能够对推送到所述存储库的用户进行身份验证(因为 本地协议没有身份验证)。
因此,这两种解决方案都不是一个容易解决的问题。
Update 2014 (3 years later)
As mentioned by Adrien Be in the comments
See "Using Branch Permission"
Original answer (July 2011)
The usual solution is a second repo where:
But that would require a second repo.
Another solution would be, with an authorization framework like Gitolite, to give push access to an Autobot branch.
It requires only one repo, but with a server (ssh or apache) able to authenticate the user pushing to said repo (since the local protocol don't have authentication).
So both solutions aren't an easy fix.