Reputation: 193
I had a local repository named a
which had been already associated with a remote repository named A
of GitHub account A-github
,
and I also had a local repository named b
which had not been associated with any remote repository yet.
I created a new remote repository named B
of GitHub account B-github
, and I tried to do the first push to B
from local repository b
.
B
reflected the commits of b
.B
was not the name of b
, but the name of the other GitHub account A-github
.(The icon image was also the same as set in A-github
page)A-github
), I went to the page of A-github
account.Contribution activity
on the Overview page of A-github
.I'm guessing this was the problem of git config
of the local repository b
. I tried git config -l
and found that user.name
and user.email
were doubled like this:
...
...
user.name = the user name I use for repository `a` and `A`
user.email = the user email I use for repository `a` and `A`
...
...
user.name = the user name I use for repository `b` and `B`
user.email = the user email I use for repository `b` and `B`
...
...
...
I want to let git use a right user (b
) to do push to B
and if I can, I want to cancel the push done by A-github
What should I do?
I've installed git filter-repo
via package manager and tried the method shown here,
using git filter-repo --mailmap my-mailmap
with the text file formatted as
Correct Name <[email protected]> <[email protected]>
Then, I pressed enter. However, the result is the shell just returned
Python
and it seems nothing happened. I think I need some more trials.
I'm a bit afraid that I'm using git filter-repo
correctly.
My comprehension is that I firstly need to create a text file named as formatted below:
Correct Name <[email protected]> <[email protected]>
where Correct Name
and <[email protected]>
is the name and email with which I want to replace the ones of present author and committer already written in the commit log, <[email protected]>
is the present email written in log.
I'm entering email with putting <>
on both ends.
Is this ok?
I found that it seemed I needed Python installed in advance on my PC to use git-filter-repo
command, so I installed Python via Scoop a while ago.
I tried again implementing the command above, and this time the shell returned:
Cannot read my-mailmap
Another difficulty came.
Now that the discussion is going off this topic,I posted a new question and I would close this question. Thanks for the advice.
Upvotes: 2
Views: 626
Reputation: 1323263
First, do a git config -l --show-scope --show-origin
in your repository: that way, you will be sure to see what is a local config, which overrides a global config.
Second, you can use git filter-repo
to change the user.name/email of your commits in repoB: yo will then need to git push --force
it (which is not a big issue if you are alone working on that new repository).
Upvotes: 1