0

I m using SCM-Manager(GIT).

I wish to block the force push option in a repository named "git_playground" for all branches in the remote

I'm not sure where the below config to set in the git server

receive.denyNonFastForwards true

I have tried to set the above confi in config file of the repository under [core] as

receive.denyNonFastForwards =  true

After this i cannot be able to clone that repository . So revoked it.

soundararajan.c
  • 2,538
  • 6
  • 29
  • 51
  • **Don't** manually modify Git configuration files. Use [`git config`](https://git-scm.com/docs/git-config). – axiac May 03 '18 at 12:55

2 Answers2

1

Not [core]:

[receive]
denyNonFastForwards = true

To avoid such troubles edit config with command line:

git config receive.denyNonFastForwards true
phd
  • 82,685
  • 13
  • 120
  • 165
  • do we need any restart after this changes done ? i have added that , but still force push is working . followed the `git config` command – soundararajan.c May 04 '18 at 05:34
  • Restart? Probably? The config command must be given at the server either in a repository (in every repo you want to protect) or globally: `git config --global receive.denyNonFastForwards true` – phd May 04 '18 at 15:11
1

You could also use the SCM-Manager configuration option Disallow Non Fast-Forward (available since version 1.55) at Config->Repository Types->Git. If this option is enabled SCM-Manager will block every force push. But this option is global and affects every repository on the SCM-Manager instance.

sdorra
  • 2,382
  • 18
  • 16