Where is the Git commit info set in Xcode 4?

2019-02-11 03:23发布

问题:

Note that this isn't a problem I face, I'm more interested in what is going on here, because this just doesn't make (much) sense to me.

Where is the info shown below set?

According to Daniel, when he runs a git log, the committer is shown as Daniel@daniel-macosx.local, which is his username on his Mac followed by his Mac's network hostname, so it isn't getting the Name and Icon from Gravatar or a similar service.

The photo shown is his user photo on his Mac.

Is it possible/where can a user set the committer info?

If it is possible to be set, should it be set in the global/project .gitconfig file, or somewhere else?

回答1:

Where is the info shown below set?

Actually, I think the answer was staring right at you all along... I'm fairly certain that all this info really is coming from my contact card, and is stored and used by Xcode independently of the version control system. In fact, I mentioned in an earlier tweet (which you replied to) that I'd used my contact card. I probably should have pointed out that, initially, the commit author name in use was my local username and there was no photo.

Clicking on the photo reveals a popover with a number of fields I can fill in about myself, like first name, last name, and some contact information. There's a Choose Card... button, which I used to attach my card.

So it does seem like Xcode attaches my contact card to my commit info, but it turns out that Xcode uses it for its own display purposes rather than tying it to my Git author info. Plus, as mentioned in the comments, I can't find the info in any of my Git config files, and furthermore I don't use GitHub yet (cue recommendations, links and testimonials as to its awesomeness).

Oh and I just checked... changing one of the fields in my contact card causes the change to be reflected in Xcode, and vice versa.



回答2:

See the Set your user name, email and GitHub token page on the GitHub support site:

git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@youremail.com"
git config --global github.user username
git config --global github.token 0123456789yourf0123456789token

Maybe you could make sure these keys are set not in your project .git/config file but in your global .gitconfig file.



标签: xcode git xcode4