0

This might be a silly question or there might be a gap in my understanding of git. I understand that git is a distributed VCS. In git, in my local development environment, i can change the user and the email in the .gitconfig or using the 'git config' command, and then once i view the 'git log' the modified username and email will show up. The same will show up for all the users who clone the repository, once i push the changes.

So, Is there a way to allow/restrict specific users from performing a commit on the git repository or is there a way to prevent developers from changing their git username and email?

Update: To complete my question/requirement, I have setup gitblit on a VM in a my office network and migrated the data from svn to git, along with the users. Just like in SVN, only those users in git must be allowed to commit/clone/push etc.

Liam
  • 27,717
  • 28
  • 128
  • 190
Iowa
  • 2,171
  • 4
  • 22
  • 31
  • If they clone via `ssh` they should have their local `ssh key ` registered in remote(`github` or `gitlab`). Or else they are not allowed to push – Sravan May 08 '18 at 10:18
  • 2
    the gitblit docs seems to cover this? http://gitblit.com/administration.html – Liam May 08 '18 at 10:27
  • @Liam, thanks, thats exactly what i was looking for. But the description says "all merges require "--no-ff" to enforce committer identity". What does it mean? – Iowa May 08 '18 at 10:43
  • 1
    Do you mean this? [What is the difference between `git merge` and `git merge --no-ff`?](https://stackoverflow.com/questions/9069061/what-is-the-difference-between-git-merge-and-git-merge-no-ff) – Liam May 08 '18 at 10:47
  • As a side note: if you're used to SVN, and are switching to Git, it's unwise to attempt to use Git the way you used to use SVN. The version control models are too different. (And, while Git itself can be quite frustrating, the conversion from centralized to distributed is very freeing.) – torek May 08 '18 at 15:04

1 Answers1

0

You can use github.com or gitlab.com to even protect particular branches from commits from disallowed users.

Update:

Also you can read about git hooks. There are client-side and server-side hooks which could be helpful for you to restrict different things.

falinsky
  • 7,229
  • 3
  • 32
  • 56
  • Is it possible to do the same gitblit setup which i have done on my local VM? Or do i need to create and configure pre-commit hooks to check the user and allow/disallow? – Iowa May 08 '18 at 10:17
  • 1
    @Iowa it seems that [Committer Verification](http://gitblit.com/administration.html#H11) should help you. – falinsky May 08 '18 at 16:11