63

How to remove contributor from showing in the main page of project:

enter image description here

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:

enter image description here

4
  • Did you create this repository? Commented Jun 15, 2017 at 9:03
  • 6
    Possible but people are going to scream at me. Clone a local copy, delete the Github repository. Delete the .git folder in your local repository. Then initialize a new repository locally git init, then create a new Github repository and push your new local repository up to it. This obviously removes all history! Commented Feb 1, 2021 at 9:06
  • 1
    This is something Github should consider. Something like this can be implemented, repo owner asks the contributor that i want to remove your name from showing up on the repo main page, and then contributor can either accept or reject that. Commented Oct 14, 2021 at 8:36
  • As of 21/11/2025, after or before rebasing and or removing access from project/settings/access, all you need to do on github is to block the contributor(s) you might want to remove and they immediately get removed from all repositories. Commented yesterday

13 Answers 13

114

The below method works in my case at least.

  1. In the GitHub web interface, change a branch name (From main to main1 for example). You can do that from the url https://github.com/[user]/[repo]/branches. It will update the contributor list on the repository dashboard.

    enter image description here

  2. Then change the name back (main1 to main).

I have multiple GitHub accounts for different projects and different communities and I accidentally pushed a commit using a wrong account. I changed the author of the commit, but the wrong account was still on the contributors list in the repository dashboard.

My method keeps the commit history as well as the GitHub action settings and issue history. But I did not check if pull requests are kept.

Sign up to request clarification or add additional context in comments.

11 Comments

Can confirm this worked beautifully. This is very useful after detaching a forked repo from the original via GH support.
Worked for me having removed "bad" commits with wrong account as author.
Changing branch names didn't work for me.
My bad. This method does work but you apparently need to wait an hour or two for the contributor without commits to be removed. Thanks and sorry for confusion.
It worked in a way (after some minutes), but removed all contributors. Thats not an issue for me, as I am the sole contributor at the moment and the contribution will be restored with the next commit/push, but may be a problem for larger projects. It may be that this also fixes itself by waiting.
|
36

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.

7 Comments

What happens if you revoke their access but keep their commits, are they then removed from that number on the main page? If not, what if you also remove or rename their commits?
If you revoke their access no. If you remove their commits I would believe so, renaming them perhaps. But bear in mind the significant impact of renaming and removing commits
I understand all of that, it just seemed to me that you categorically said "No, cannot be done" and your comment now says "Yes, I think you can do it, just do it another way". If his main goal was to get rid of the contributors, it seems to me that there is a way after all.
Rewriting history in git should really never be done, and as such I will always eliminate it as an option. Even at that I cannot guarantee that it will achieve the desired effect.
this happened to me. I renamed my user id, and someone else took it. I have some entries in the repo as userid@github. Now they are showing up as a contributor, even though they have nothing to do with my project. Very annoying. Github needs to allow you to attribute commits to whoever you want, and not just the user email in the repo history.
|
23

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.

1 Comment

It's a bit risky (like someone can delete wrong account by accident :D), but this solution works fine.
10

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.

6 Comments

This word around is not working!
Then you must have a commit or something related to that user linked with the repo. You should remove all the things related to that user from the repo. then try this again.
This have worked for me. Just had one commit from a wrong account. I first removed it from the branch and then I've push forced the branch to rewrite it in the remote server. Then I've changed the repository visibility and it did the trick. Thanks!
Only working solution for me (August 2023)
Thank you so much. This was the working solution for me
|
9

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="[email protected]"; \
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.

Comments

6

It is possible but might be challenging.

You need to rewrite history (which is not recommended usually).

How to do it?

  1. You should rewrite all the history commits of the contributor and change the commits to a different author. There are some ways to do it, I found the simplest is by executing amend on an existing commit with changing the author. e.g: Bellow a commit pick you should write:
    exec git commit --amend --author="{NewAuthorName} <{NewAuthorEmail}>" -C HEAD
    
    Watch this explanation https://www.youtube.com/watch?v=7RZgtT4cbw0.
  2. After the contributor doesn't have any commit in the history - update any GitHub setting to refresh the list and then wait for a couple of minutes. For example, you may update the default branch name under your repository => Settings => Code and automation => Branches => Default branch. And then return the original branch name.

After both updates, wait a couple of minutes and it should remove the contributor from the list.

Comments

4

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.

  1. Create a new replica repository

  2. Copy the cherry picks from original repository which have only the commits with intended authors.

  3. 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.

5 Comments

Exactly my scenario - but what does repo2 refer to?
repo2 is simply the local name of remote repository from which you will be pulling in the commits.
When you say "replica" repository, do you mean just an empty repo to which you will push the cherry picked commits or an actual mirror repo?
@PashaSkender : Yes just a new empty repository.
@ViFI I am a novice in git. I tried your solution. Does cherry-picking commits preserve previous commit details like dates? In my case, it didn't. The commit dates in the new repo got overwritten by today's date. Am I doing something wrong?
1

None of the answers here worked for me. What I did and worked:

  1. Changed all commits emails (two) that pointed to the other account using git-filter-repo tool, like this.
  2. Follow the suggestion of renaming the branches, main -> main1 -> main (didn't work, at least not instantaneously).
  3. Returned to the repo about two or three hours later and it was correct.

Perhaps the second point is not necessary.

Comments

1

Perfect Method I Found

All the answers before is telling you to rewrite the commit history, and change the branch name back and forth.

However, there is a much easy solution for this, You WON'T need to rewrite anything in your repo.


Just go to Account Settings of your GitHub account, and block the account you want.

You can unblock the account later.

At the moment you will still see the contributor showing on the list, but the number of contributors will be reduced by one.

After a few hours or a day, you will see that the contributor is no longer showing in the list.


Side-effect: The account you block will be disappeared from all the repo owned by you.

1 Comment

This is a perfect method if one has accidentally used an old account to push into GitHub!
0

Fix commits showing a user who copied/cloned a repo

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 [email protected]

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.

Comments

0

Workaround tested 2022

(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.

  1. Download Github for Desktop
  2. Create a dummy folder and point Github for Desktop to the dummy folder when it asks for a location to clone the repo (Do not use your working directory)
  3. Once you clone the repo, you should see history tab, select the commit (assuming the latest one is from contributor you want to remove) and select option for 'revert this commit'
  4. Force push this change to Github
  5. Now that the there are no commits from the user in the main branch
  6. Create a new branch from the default branch and navigate to Settingg of the repo on github.com
  7. On settings page change the default branch to the new branch you created
  8. Since this new branch does not have commits from the contributor to be removed you will force github.com to refresh the contributor list automatically and the contributor will removed.
  9. Now you can change the default back to the old branch (usually master/main) and you will find the contibutor removed from the refreshed list.

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.

Comments

0

3 steps

  1. Remove all branches that that user might have contributed to

  2. Do any number of things to remove all commits related to that author from your remaining branches. Some of your choices:

    1. rebase or interactive rebase and force push
    2. filterbranch and force push
    3. cherry-pick and force push
    4. squash and force push
  3. Turn you repo private, then turn it public again

Comments

0

I accidentally commit README.md with my other acc. I tried creating new repositorie about 8 in total. but my contributor badge from my other account kept popping up. No matter what I deleted (files, commits, etc.), the badge still existed! Even though it's no longer in the commit history, the contributor badge remained.

imagine contributing for NOTHING? pretty no sense.

It took about 3 hours for me to actually get rid of this problem.

And here’s how I dealt with it :

WARNING WARNING WARNING : BACKUP YOUR ENTIRE PROJECT FOLDER FIRST!!

  1. rename main repo to main1

  2. run command :

    git branch -m main main1 git fetch origin git branch -u origin/main main1 git remote set-head origin -a

  3. run command :

    git rebase -i --root

  4. Delete the commits related to the contributor by changing pick to drop :

before :

pick ce0a125 commit1 pick 0011df3 commit2 pick 193fe65 commit3
pick 7a0c339 commit4

after :

pick ce0a125 commit1 drop 0011df3 commit2 pick 193fe65 commit3
pick 7a0c339 commit4

  1. run command :

git push --force

  1. Check the Git website to confirm that the contributor badge you wanted to remove is gone.

  2. Rename the branch back from main1 to main.

  3. run command :

    git branch -m main1 main git fetch origin git branch -u origin/main main git remote set-head origin -a

DONE!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.