Change the username for Git in Xcode?

六眼飞鱼酱① 提交于 2019-12-02 17:41:48
VonC

As mentioned in "Where is the Git commit info set in Xcode 4?", XCode takes user information from your contact card from your (2012) Address Book (called Contact in 2014).

Changing your contact card would change user information (for new commits)


Update 2014 (2 years later), as illustrated in sergtk's answer, XCode (5+) now supports the git config user.name and user.email.

The following terminal commands works for me:

xcrun git config --global user.name 'new_user_name'
xcrun git config --global user.email 'new@email.com'

These are to update user name and e-mail respectively.

After execution of that commands successive commits to Git via Xcode will use the data specified in it.

Greeso

Since I have multiple projects with different commit names, the solution provided by @sergtk does not work for me. Instead, I did the following:

xcrun git config --local user.name 'new_user_name'
xcrun git config --local user.email 'new@email.com'

Also, note that the first commit needs to be changed, so I used the solution provided here to fix this: Change the author and committer name and e-mail of multiple commits in Git

I start working from corporate mac and had the same problem with bitbacket repository. Any answers didn't help me. Neither removing previous user from address book and saving my own nor terminal commands. One day I tried to work with new repo from SourceTree (free soft from Atlassian). I have replaced user name and mail with my own in preferences and all was ok. I had commits with my own credentials. Ye! I hope my solving will be useful!

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