git repository in single system user environment
in SVN it was possible to work in several peop开发者_JS百科le on one working copy of a repository. SVN prompted for a username and password and commits were attributed to the user which logged in even though they accessed the server with one system user.
However, in git, I cannot find a way to acomplish this easily. I know the preffered workflow is to have a repository clone for each developer, but that is not possible in some cases.
Any ideas how to solve this?
Git or any DVCS doesn't support a "centralized" authentication due to its distributed nature. I.e. you can sign each commit with any string you want.
The way I managed that in a common working tree was by defining an alias for git:
The alias was referring to a wrapper, which:
- asks for a username and email, and then set
GIT_AUTHOR_NAME
,GIT_AUTHOR_EMAIL
,GIT_COMMITTER_NAME
,GIT_COMMITTER_EMAIL
. - call the actual
git
executable with all the parameters initially passed to the wrapper.
From there, all git commands are done with the right credentials.
精彩评论