Setup Git user name/email for github/bitbucket on your machine

So you have github or bitbucket account and repositories setup already. But the problem is if you did not set the user name and email on your machine, most probably you will see ‘Author not mapped‘ with question mark sign. It is because your account is not synced with github or bitbucket. But no worries, it’s quite easy to do that. Open terminal, if haven’t installed git yet, install it 1st and proceed with the steps below.

Method-1: Setting name and email globally:

This method will set your name and email globally which means that you will not need to set it for each repo you create next time.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”4″ tab_size=”4″]

git config –global user.name “YOUR_NAME”

git config –global user.email “test12@gmail.com”

[/cc]

Change to your name and email address above.

Method-2: Setting name and email for specific repository:

Here we apply it to a specific repository. Change directory to the root of the repository.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”4″ tab_size=”4″]

git config user.name “YOUR_NAME”

git config user.email “test12@gmail.com”

[/cc]

Change to your name and email address above.. Just to verify it in config file:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”1″ tab_size=”4″]

cat .git/config

[/cc]

That’s it.