Search code examples
gitgithubcommitgit-commit

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


Solution

  • 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>"