My GitHub commits are not from "my" user

Starting in a few weeks, my GitHub commits are listed under the author muheiminstead jmuheim. I have no idea how this has changed, and I would like to change it to jmuheim, but I have no idea how to track this.

I am on macOS and my password is stored in the keychain. But I do not find any account there muheim, only jmuheim.

I have one id_rsa.pubon my system, and I'm sure it is mapped to jmuheimon GitHub, but I'm not an SSH specialist.

So why and how does the git pushuser use it muheim? If I cannot fix this, I will try to delete the user muheim(who is an old user that I used several years ago), but I hope someone can help me track this issue.

+4
source share
2 answers

Authentication has nothing to do with user.name/ user.emailused for commits.

Check the value git config user.name: you can change it to the previous value.

And you can replace your username / email for old commits .
(Although this will rewrite the repo story: if you only work with it, it doesn’t matter)

git remote -v: URL- https, SSH- id_rsa.pub .

: new-user/repo, , user.email , .
, , :

 cd /path/to/repo
 git config user.email email-of-second-GitHub-account

?".

+1

:

git config --global user.name jmuheim
git config --global user.email jmuheim@example.com

, . , , git , . GitHub , "" , :

  • , :

    git clone --bare https://github.com/user/repo.git
    cd repo.git
    
  • script, muheim jmuheim

    #!/bin/sh
    
    git filter-branch --env-filter '
    
    OLD_NAME="muheim"
    CORRECT_NAME="jmuheim"
    
    if [ "$GIT_AUTHOR_NAME" = "$OLD_NAME" ]
    then
        export GIT_COMMITTER_NAME="$CORRECT_NAME"
    fi
    if [ "$GIT_COMMITTER_NAME" = "$OLD_NAME" ]
    then
        export GIT_AUTHOR_NAME="$CORRECT_NAME"
    fi
    ' --tag-name-filter cat -- --branches --tags
    
  • GitHub

    git push --force --tags origin 'refs/heads/*'
    

git clone

, , :

git log --all --full-history --pretty=format:"%ae  -  %ce  -  %an :%cn"
+1

Source: https://habr.com/ru/post/1691475/


All Articles