Git:在没有推送权限的情况下跨分支的团队协作 [英] Git: Teamwork across branches without Push Permission

查看:193
本文介绍了Git:在没有推送权限的情况下跨分支的团队协作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为Scrum团队工作,该团队正在与另一个Scrum团队使用共享的git存储库。为了方便起见,我们会打电话给我的Scrum团队 Autobot 和另一个霸天虎 团队霸天虎具有对存储库的全面访问和访问权限,并负责该框架。

Team Autobot 能够拉动,但不推动。一般来说,如果团队成员独立工作就没有问题。然而,出现这样的情况时,拉到另一个团队成员分支是有用的。截至目前, Autobot 还没有被霸天虎(easy fix)授予推送访问权限,所以需要解决。



一个用例示例:考虑如果 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添加重要文件。

现在,帮助 Optimus 通过编辑important_file.py。他创建了自己的分支,并直接从分支拉取,并尝试推送:

 #! / 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:添加内容'''> important_file.py
rodimus @ workstation1:〜/ git / work_project /> git commit -m添加TODO
rodimus @ workstation1: 〜/ git / work_project /> git push〜optimus / git / work_project sdev

什么是适当的过程呢?不希望有第二个存储库,但如果需要可以使用。

解决方案

更新2014年(3年后)

正如,给将访问权限推送到Autobot分支
它只需要一个回购,但使用服务器(ssh或apache)能够验证用户推送到所述回购(因为本地协议没有认证)。

因此,这两种解决方案都不是一个简单的解决方案。


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.

解决方案

Update 2014 (3 years later)

As mentioned by Adrien Be in the comments

Stash implemented branch level permissions

See "Using Branch Permission"


Original answer (July 2011)

The usual solution is a second repo where:

  • Team Autobot can push to
  • Team Decepticon can regularely fetch and see if there is anything to merge

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.

这篇关于Git:在没有推送权限的情况下跨分支的团队协作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆