开发者

Git commit related issue - Commit currently takes login credentials of another user having similar priveleges

开发者 https://www.devze.com 2023-03-27 04:47 出处:网络
I\'ve been made the collaborator(say, i\'m User 1) of a git repository. Currently due to some settings which I must have wrongly done unknowingly, all commits are being committed as if being done by t

I've been made the collaborator(say, i'm User 1) of a git repository. Currently due to some settings which I must have wrongly done unknowingly, all commits are being committed as if being done by the owner(another user - say user 2) who has shared the access with me.

I guess while doing a git clone of the rep. I had done something wrong.

How can I get myself as the owner of each commit?

What do I need to change?. I'm just currently aware of a .git/config file .

What precautions do I need to take to avoid this in the future.开发者_运维问答

Thank you very much..


You need to configure your:

  • user.name
  • user.email
  • github.user
  • github.token

in order to be able to push directly your commits to the repo where you are now a collaborator. See GitHub help.
The email must be the one used with your GitHub account.

You could also, through a filter-branch, reset the author name and email of your previous commits, and force a push (but that will rewrite history, so you need to make sure that won't bother anyone else who would have already clone the repo).


Check that the .git/config file doesn't contain the other person's username and email address. If it does, remove them.

This should generally be set globally in each user's own ~/.gitconfig file; you can do it like this:

$ git config --global user.name  "Your Name"
$ git config --global user.email "your@email.address"
0

精彩评论

暂无评论...
验证码 换一张
取 消