Change the username for Git in Xcode?
The following terminal commands works for me:
xcrun git config --global user.name 'new_user_name'
xcrun git config --global user.email '[email protected]'
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.
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
.
That will fill out:
Using xcrun
before the git config
commands allows to locate or invoke coexistence- and platform-aware developer tools from the command-line.
(assuming the Xcode Command-line Tools is up-to-date)
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 '[email protected]'
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