2

I have a following scenario:

We have environment with custom program that several people develop in - basically shared file system location and it's under Git control.

People change stuff in this location. I want to be able to switch users when they commit - what's the easiest way to do it?

1
  • 1
    git config user.name and git config user.email? This sounds like a terrible idea. Commented Jul 18, 2014 at 18:39

4 Answers 4

2

As long as each person is logged in with their own separate account, make sure that each of them has a .gitconfig file in their home directory.

Add a [user] section and define the name and email:

[user]
name = John Smith
email = [email protected]
Sign up to request clarification or add additional context in comments.

1 Comment

this looks like the best solution so far, let me try
1

On each machine should have 1 User git, configured with the command git config --global user.name = USER_NAME and git config --global user.email = USER_EMAIL, Do you need to have multiple users on the same machine? If it, I think the easiest way is a script that requests User and email before commit, to run this commands before commit.

Comments

0

Create separate branches for each person working on the project. I suppose you could think about it like usernames and then you can git checkout <branchname> (this switches between branches) then you will all have you own repos and be able to store you own commits.

Comments

0

If you just want to change the username of the person who makes the commit:

git commit --author="Author Name <[email protected]>"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.