I'm having a bit of a brawl with Xcode and GitHub at the moment.
I'm trying to get my Xcode commits to my GitHub repo to use my GitHub username, but Xcode insists on using the username on the Mac.
I searched for a solution and found this at first:
xcrun git config --local user.name 'new_user_name'
xcrun git config --local user.email '[email protected]'
I ran these commands inside the project's
folder, and had a look at its config file to make sure these changes showed up (they did).
Then from inside Xcode, I went to the Source Control menu and chose Push.
Sadly, when I looked on GitHub, the commit happened with the Mac username again.
I tried restarting Xcode, and running the above commands with the "
" flag, but still no luck. I followed the advice of this article:
but the environment variables they warned about weren't set, so it seems like I should be good to go.
Obviously people were having success with this method in the past, and I'm wondering if this functionality broke in Xcode 8.21 (or earlier).
Anyone else having this problem?
Is XCode not quite integrated with git for situations like this?
To be clear: When I saw the wrong username show up in GitHub, I deleted that repository and started over, and did the push again from Xcode after
having run the xcrun commands. So this isn't an issue of having previous commits with the wrong username, and that future ones will correct it. I can't get any commits at all to show up with the right user name. Thanks.
Here's what I've tried since posting this question.
git config --local user.name
git config --local user.email
Both these (and the --global version) returned correct values.
Then I pushed from the command line:
git push origin master
... and when I looked at my repository, I could still see the Mac user name at the top of the repository!
So, none of this has to with Xcode, and obviously I was confused about where user.name is used. Now, I'm guessing what I'm seeing is the last commit message from my local
<MacUserName> committed with <MacUserName> <last commit message>
So GitHub is using my locally-made logs to display commit messages, and using that
user name instead of the user.name in my git settings (which is what I thought/hoped would happen). Am I right? It's just, I really don't want that Mac user name showing up anywhere in my GitHub repos, and was hoping there was a way to prevent it. Is there?
Sorry for the confusion.