Can I link ssh username to commit using git over ssh?

I am trying to install a git shared repository via ssh by copying the public keys of users to authorized_keys. I would really like the “username” from the ssh key to be part of the commit history in the repo (so the user “joe” cannot just provide his name “kate” - we need some kind of accountability) Is there a way to do this ?

+5
source share
3 answers

Just no, no way. The reason is that the author and committer data are set when committing, and this usually happens locally. A git pushwill happen later to direct existing commits to the remote repository. Since commits are already made and reference the SHA1 hash, they cannot be changed during the push operation.

What you might think is due to the presence of a pre-update or update hook that prevents people from pushing back commits that they haven't created, but that can interfere with many legitimate goals. You may find that trusting your users is the only reasonable option.

+5
source

git. , joe kate. joe kate:

*  joe: Merge branch 'kate'
|\  
| * joe: update foo
* | kate: fix test
* | kate: add test
|/  
* joe: initial commit

joe , , kate joe.

+5

In Git-hub, each user has their own git server repository. Maybe you could let users just click there, and you will have an admin that falls into the "official" repository? Thus, there is complete traceability and accountability. You will also have a moderator with maximum responsibility.

+1
source

All Articles