0

Whenever I commit through the SSH, it has the author of the commit as "root". How do I change it to my actual Github username so it links to that account?

It's an Ubuntu machine if that helps.

Doug Smith
  • 29,668
  • 57
  • 204
  • 388

2 Answers2

1

Create a .gitconfig file with these fields in the root of the repository:

[user]
    email = john.doe@mail.com
    name = John Doe
Fredrik Pihl
  • 44,604
  • 7
  • 83
  • 130
  • Other answer is better, your solution works at the repo level (which isn't a good thing for setting user name), while cjc343's answer works at the system's user level. – CharlesB Mar 19 '14 at 14:32
1

This tutorial covers setting your email in your git configuration. Note that GitHub links commits based on the email(s) connected to your account.

In short: git config --global user.email "me@here.com"

The configuration node for your name is user.name.

cjc343
  • 3,735
  • 1
  • 29
  • 34
  • You can also omit the --global flag if you only want to modify those settings for a particular repository. – Fredrik Pihl May 16 '13 at 16:47
  • I think it just ends up coming down to personal preference -- I like `--global` because you set it once and it applies to any repository as the current user (unless overridden for a particular repo). `--system` I wouldn't typically recommend, but it can be useful if you are the only user of several accounts on a machine. – cjc343 May 16 '13 at 16:54