Xtreme
Xtreme

Reputation: 1591

How do I use two Git accounts on the same computer?

I'am working with one project and we use Git with https://bitbucket.org but now I will also start working in another project that has a different bitbucket account. How can I work with this two projects from the same computer and use different git config file and git remote url?

E.g in my current project, I have the following setup

user.name=Martin Andersson
[email protected]
remote.origin.url=https://[email protected]/123456/123456.git

but my new project will have the following setup

user.name=name-company
[email protected]
remote.origin.url=https://[email protected]/abcd/abcd.git

How can I easily switch between these accounts in Git terminal and keep all the settings, commits etc

Upvotes: 0

Views: 450

Answers (2)

Yurii
Yurii

Reputation: 877

You can set different configuration for different git repos. More details here: https://orrsella.com/2013/08/10/git-using-different-user-emails-for-different-repositories/

Upvotes: 2

TheGeorgeous
TheGeorgeous

Reputation: 4061

Well it's simple, don't use the --global option when using git config. This will set the configuration for the specific repo you are currently in.

For more details, read the documentation:

http://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

Upvotes: 3

Related Questions