Skip to content

Remove a commit #22717

Discussion options

You must be logged in to vote

You cannot hide a specific commit. Anyone who can clone your repository will get the full history, that’s one of the core principles of git.

However, what you can do (and relatively easily because your repository is private): Use git rebase to change the commit, so it doesn’t contain the token any more. Specifically, you’ll need to do an interactive rebase and edit the commit that introduced the token.

After you’re done with the rebase make sure the code looks as you want it, you can then force-push it to your repository.

After that you should contact Github support so they can make sure the original commit with the token isn’t cached any more (otherwise it’s not on a branch, but might be…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants