When I work with some clients or employers, they will sometimes provide me with an email address to identify me within their system and source control. If they provide the computer to work on and keep a local repository, I'll have their identity configured on that computer as global identity. Sometimes, they do not provide a computer or I'll work on the code on one of my personal computers in addition to their computer. In those cases, I don't want my personal identity to show up on the commit history of their repository since they've taken the time to create an identity for me. Git provides an easy way to specify an email address on a per repository basis.
To set the email address (identity) in a specific repository, use the following commands while in the local repository directory:
git config user.name "Julian Easterling" git config user.email "identity@example.com"
Alternatively, you can edit the .git/config
file manually and add the required information under the [user]
heading:
[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true hideDotFiles = dotGitOnly [remote "origin"] url = https://git@example.com/project.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [user] name = Julian Easterling email = identity@example.com