0

We have a number of shared Windows machines that we are making commits on. TortoiseGit is used for commits and pushes.

Our preference is to prompt users for credentials on each commit/push/pull.

We are able to get TortoiseGit to prompt us for the commits and pushes, however the commit/push is not tagged with the username on our Atlassian Stash. Instead it is using whatever value is configured in git user info.

How can we configure TortoiseGit to use the prompted username for user info during a push?

MrTux
  • 32,350
  • 30
  • 109
  • 146
JeffV
  • 52,985
  • 32
  • 103
  • 124
  • 2
    This shows a misunderstanding of how Git works. When you push, you copy the commit(s) that you have locally to the server. Who authored the commit and when, who created the commit and when, that's part of the commit that's going to be copied, it's not just metadata that can be freely changed after the fact. What you're asking for is possible in theory, but difficult: it would require creating new commits with the correct author/committer info just before pushing. –  Sep 21 '16 at 13:54
  • As an addition to @hvd: The keyword for altering history is called rebasing and should be used really carefully. – MrTux Sep 21 '16 at 13:58
  • @hvd, I see what you are saying. The push is prompted for credentials by remote server but commits are going to the local repo. Not looking to rebase history. Maybe just force a prompt for author field on each commit rather than using configured user into. – JeffV Sep 21 '16 at 14:10

1 Answers1

0

You might be able to achieve what you want by creating a Git Hook pre-commit or pre-receive to check the information of the committer.

Here are some useful links:

Stop a git commit by a specific author using pre-commit hook

How to change author email at commit time with hooks

Community
  • 1
  • 1
CMPS
  • 7,733
  • 4
  • 28
  • 53