1

in SVN it was possible to work in several people 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?

vvondra
  • 3,022
  • 1
  • 21
  • 34
  • Why is cloning not possible? You didn't store massive amounts of binary data in the repo, did you? – Fred Foo Sep 13 '11 at 11:19
  • @larsmans: it can happen when you are defining a git repo in tree structure managed by a *generic* account (ie not an actual human user). You need then to authenticate each commit by something else than the generic account name (otherwise, that isn't very informative since the same "account" would be referenced by all commits). – VonC Sep 13 '11 at 11:24
  • @VonC: I encounter that situation regularly; the solution has always been to clone into developers' own spaces. – Fred Foo Sep 13 '11 at 11:27
  • @VonC: git actually does not care about the current login; in every clone, you can configure different user; then each dev. needs to use its own clone in order to be signed properly. This should be sufficient scenario except if there is a diskspace limitation as larsmans noted – Petr Kozelka Sep 13 '11 at 11:39
  • @Petr: git cares about the current login, in order to compute a default author name. When you *cannot clone*, you need another solution. – VonC Sep 13 '11 at 11:47
  • @larsmans: not possible in our case: the git repo is there to record any change in configuration files of the tools managed under the generic account. – VonC Sep 13 '11 at 11:48
  • VonC understood it correctly, there are applications we cannot clone easily, thanks for the answers. – vvondra Sep 15 '11 at 09:50

1 Answers1

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250