Using multiple Git accounts

a 夏天 提交于 2021-02-08 20:55:36

问题


Is it possible to have multiple git accounts in Eclipse(egit) and choose which one to use each time?

Example:
I currently have a git account, with username: workuser and email: workuser@company.com and this account is used for the company's repositories.

I want to use another account which will be used for my github repositories and will not have any relation to the first account (workuser), e.g. username:githubuser and email: anothermail@something.com

Is it possible to have both accounts and choose each time which account will be used in order to work on the related repositories(different for work and github) ?


回答1:


I don't know about egit, but by default, git config (without --global) stores values in repository-specific file, so the only thing you need to do is:

$ cd project-repo
$ git config user.name "<name>"
$ git config user.email "<mail>"


来源:https://stackoverflow.com/questions/25379478/using-multiple-git-accounts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!