I'm using Visual Studio with GIT, I'd like to lock some project files to prevent any of team members to push any changes related to
Asked
Active
Viewed 6,374 times
1
-
6Possible duplicate of [Is there a way to lock individual files or directories on fork when using git?](https://stackoverflow.com/q/13662255/608639) – jww Sep 04 '18 at 08:30
1 Answers
2
With git alone, there is no built-in way to lock a file.
If you use a server (say gitolite
or gitlab
), the server may offer a way to do this :
- if found this link for gitolite
- this link for gitlab (it appears to be a feature of the paying version)
Otherwise, you can program this feature on your own central repository, using git hooks :
if you want to reject pushes on the central repository that modify a certain file, have a look at the pre-receive hook (you can search SO to look for uses of pre-receive hooks ;) )

LeGEC
- 46,477
- 5
- 57
- 104