How to remove contributor from showing in the main page of project:
Link https://help.github.com/articles/removing-a-collaborator-from-a-personal-repository/ says it possible in settings, but I dont see any collaborator in there:
How to remove contributor from showing in the main page of project:
Link https://help.github.com/articles/removing-a-collaborator-from-a-personal-repository/ says it possible in settings, but I dont see any collaborator in there:
The below method works in my case at least.
I have multiple GitHub accounts for different projects. Each for different community. But accidentally, I pushed a commit using a wrong account. I changed the author of the commit, but the wrong account was still on the contributor list on GitHub dashboard. My method keeps commit history as well as GitHub action settings and issue history. But I did not check if pull requests are kept.
You cannot (at least without rewriting history - which is highly unrecommended).
Those users have commits in your repository history, and therefore lines of code have been added by them. Even if you remove all their lines of code they will still show as a contributor.
Contributors are not collaborators.
Collaborators are contributors authorized by the repository owner to have direct (usually write) access to the repository, meaning they don't need to fork the repository and they can be assigned to issues among other things.
I accidentally pushed a commit from an old account. The old account remained on the contributors' list even after I had removed the commit. I had to remove the old account from GitHub to make it disappear from the list.
You cannot remove it, but you can change their name (to yours). Yet, I would strongly advise not to, because this would affect all other collaborators and contributors (see below).
This is described in detail here. In short, you have to use filter-branch
, e.g. through the following script:
git filter-branch --env-filter '
if [ "$GIT_AUTHOR_NAME" = "OLD NAME" ]; then \
export GIT_AUTHOR_NAME="NEW NAME" GIT_AUTHOR_EMAIL="new.name@mail.com"; \
fi
'
The reason why better not - it comes with some serious side effects, such as invalidating all subsequent commit hashes, as also mentioned by Peter Reid.
Assuming, it is being done with all the right intentions and, you are the owner of repository - you can use rename
feature on repository. Essentially, create replica of repository and swap repository names like you swap variables with steps below.
Create a new replica
repository
Copy the cherry picks from original
repository which have only the commits with intended authors.
Rename the original
repository to to_be_deleted
and replica
to original
.
Commits from original repository can be picked with following steps.
git remote add repo2 https://github.com/mygit/original.git
git pull repo2
git cherry-pick <commit>
git push
Contributors are essentially the authors of any commit in the repository. I once accidentally put a wrong email in Author list of a commit in my repository and github started showing a new contributor in the repository. I tried reverting the commit but it didn't help. Finally I had to create / rename /delete original repository.
It is possible but might be challenging.
You need to rewrite history (which is not recommended usually).
How to do it?
exec git commit --amend --author="{NewAuthorName} <{NewAuthorEmail}>" -C HEAD
Watch this explanation https://www.youtube.com/watch?v=7RZgtT4cbw0.After both updates, wait a couple of minutes and it should remove the contributor from the list.
Change repo visibility in GitHub repository settings from public to private
and then private to public
again.
Note:-
In order to make this work you must not have anything related to that user linked with the repo like commits, releases, commits in other branches, or tags.
Caution:-
You will lose all of your repo stars and watchings. First, use other less risky methods if you care about stars.
None of the answers here worked for me. What I did and worked:
git-filter-repo
tool, like this.Perhaps the second point is not necessary.
I came to this question because I thoughtlessly worked on a copy of my repo that a colleague had downloaded, instead of my local copy.
I hadn't changed the GIT email for the copy of my repo he’d downloaded as I'd (dumbly) copied the repo from his download, so my pushes to GitHub were all attributed to his account, from his email address set (unwittingly) by him (in the ‘.git’ folder) when he logged into GitHub and downloaded my repo.
Once I’d checked and changed the email for that repo to mine (see the two commands below, executed while in the repo’s directory), my pushes were correctly attributed:
git config user.email
git config user.email myemail@mydomain.com
Unfortunately, he can’t be removed as a contributor to some of these commits without a lot of fiddling, but he’s a trusted colleague and friend so I can live with that.
(Please create appropriate backups before doing any of this)
Assuming that there are not many commits after the commit made by contributor you want to remove.
TL;DR : Revert Changes to stage where there are no contributions by user to be removed ---> Create a new branch and make it default, this is to force github.com to refresh contributor list ---> Change the setting back to old branch as default. You can delete the temporary new branch you created.
3 steps
Remove all branches that that user might have contributed to
Do any number of things to remove all commits related to that author from your remaining branches. Some of your choices:
Turn you repo private, then turn it public again