Om3ga
Om3ga

Reputation: 32951

Github commit with different user

I have a github account. When I make commits it shows a different user than my github account username. How can I fix that?

enter image description here

Upvotes: 3

Views: 1551

Answers (1)

JohnMops
JohnMops

Reputation: 235

At the root of your local folder you have a file named "config". Try to "vim .git/config"

The file will look something like that:

[core]
        repositoryformatversion = 0
        fileMode = false
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = https://[email protected]/nanhekumar/myproject.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master`

    [user]
            name = Nanhe Kumar
            email = [email protected]

A few options:

  1. Change the user name and email in this file
  2. Use "git config" command to change a global user for pushing to github or a local user for a specific folder project:

Local:

  • git config --local user.name ""
  • git config --local user.email "< your email>"

Global:

  • git config --global user.name ""
  • git config --global user.email "< your email>"

Upvotes: 4

Related Questions