0

May anyone tell me about configuration to prevent pushing directly to remote from others.
I have scenario as below: Local folder:

C:\workplace - where I create run: git init git remote -v remote [remoteURL]

I have remote branch as bellow:

remote/development -- every one also can do a lot actions in the branch. It's so bad.

My local branch:

development

How can I make /remote/development protected?

Mr Special
  • 1,576
  • 1
  • 20
  • 33
  • 2
    It can be activated easily if you're using GitHub. Otherwise you need manual git hooks. – Tatsuyuki Ishi Mar 08 '17 at 12:06
  • 2
    "Protected branches" are a feature of a Git server, like GitLab or GitHub. – Jonathon Reinhart Mar 08 '17 at 12:06
  • For the hooks, see [this answer](http://stackoverflow.com/a/6827045/7563639). – Sebastian Schmied Mar 08 '17 at 12:08
  • @TatsuyukiIshi I dont use github. Git hooks is only valid in local workspace, so I think git hooks only prevent myself. – Mr Special Mar 08 '17 at 12:34
  • @JonathonReinhart So you mean that depends on GIT server. If my GIT server does not has the configuration, I can NOT setup to prevent commits from other devs – Mr Special Mar 08 '17 at 12:36
  • @SebastianSchmied Githooks only active on local git workspace. It prevent me, not others. – Mr Special Mar 08 '17 at 12:38
  • I think the problem is the way git works. With pure git, all repos are considered equal, and everyone can do with their local branches whatever they want. Even the remote repos on github, gitlab and so on are only "special" because everyone agrees that they are. When you protect a branch on lab/hub, it probably just does the hook thing internally. You don't have power over other people's repositories, you can just ask them to use the hooks, or not pull from them. That's of course unpractical in large projects and the reason to use one of the server solutions. – Sebastian Schmied Mar 08 '17 at 12:45
  • @SebastianSchmied yep, I see. Thank you very much! – Mr Special Mar 09 '17 at 00:31

0 Answers0