-3

I got in trouble, when i find my github name and email address in most of my 12 repositories. I want to hide or change my user.name and user.email from those repositories, instead only commit date , history and github username would be fine. In all 12 repos , in github, I had checked using git config --list and git log and there I found my email and name.

In gui Github, Everybody could see my name and email in those commits. I cant put all them in private because It is my lifetime work and some are working now, I've to show recruiters.

Is there any way to change those emails and name please?

Appreciate for your help.

nerd
  • 1
  • 2

1 Answers1

1

You can only do it retroactively by force pushing, because the committer name and email are part of the data that makes up the commit-id.

For the future you can set up "keep my email private" and actually block pushes that contain your private address:

keep my email private

If you want to "fix" your old commits, you'll have to rewrite the history and may break all forks and local clones.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • Thanks @jessehouwing , This will solve my future problem. I want to do my previous old repos, It is ok for me to break all forks and local clones. Please tell How can i do this... – nerd Jan 11 '21 at 16:04
  • 1
    See https://stackoverflow.com/a/34851024/736079 – jessehouwing Jan 11 '21 at 19:16
  • It didnt changed my name and email. Only on local site where i run that script. I pushed and everything is same. – nerd Jan 12 '21 at 01:11
  • You'll need to push --all --force or do a push --mirror --force. – jessehouwing Jan 12 '21 at 08:53
  • I used both git push . --mirror --force Everything up-to-date But when using git config --list , shows same email and name. I then see in repo, It shows same name . Help!! – nerd Jan 13 '21 at 03:50
  • Have you updated those? The email in your config won't magically change, and that is stored locally on your system. https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration make sure you check the global config, as the one in the repo. – jessehouwing Jan 13 '21 at 10:44
  • I cant push, It is saying remote error. I tried to search https://stackoverflow.com/questions/49325013/error-mirror-cant-be-combined-with-refspecs it didnt helped. Please help. – nerd Jan 20 '21 at 17:24
  • You'll need to be more specific than that... – jessehouwing Jan 20 '21 at 17:57
  • I applied push, but It says remote error. I've even tried to add --mirror or --all in it but it is not solved. please help – nerd Jan 21 '21 at 02:58
  • Did you add `--force`, you'd be rewriting history, so force ir required? And what is the exact error message you get from the remote? If it's the identity protection rejecting the push, then your email is still visible in the local remote. – jessehouwing Jan 21 '21 at 08:11
  • HI, It is solved, I've now pushing all my repos. Actually my mistake, I had done git push --force --all but actually it was git push https://gitlab.com/........git --force -all. :) problem solved. – nerd Jan 21 '21 at 10:36