admin管理员组

文章数量:1123101

I git push a repo and having this error:

remote: - GITHUB PUSH PROTECTION
remote:   —————————————————————————————————————————
remote:     Resolve the following violations before pushing again
remote:
remote:     - Push cannot contain secrets
remote:
remote:
remote:      (?) Learn how to resolve a blocked push
remote:      
remote:
remote:      (?) This repository does not have Secret Scanning enabled, but is eligible. Enable Secret Scanning to view and manage detected secrets.
remote:      Visit the repository settings page, 
remote:
remote:
remote:       —— GitHub Personal Access Token ——————————————————————
remote:        locations:
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:
remote:        (?) To push, remove secret from commit(s) or follow this URL to allow the secret.
remote:        
remote:
remote:
remote:     ——[ WARNING ]—————————————————————————————————————————
remote:      Scan incomplete: This push was large and we didn't finish on time.
remote:      It can still contain undetected secrets.
remote:
remote:      (?) Use the following command to find the path of the detected secret(s):
remote:          git rev-list --objects --all | grep blobid
remote:     ——————————————————————————————————————————————————————

I follow Working with push protection from the command line - GitHub Docs and do:

git rebase -i 1fbb1eec3113333f234104065cc2da11870dd9c7~1

The error:

error: object 1fbb1eec3113333f234104065cc2da11870dd9c7 is a blob, not a commit
fatal: invalid upstream '1fbb1eec3113333f234104065cc2da11870dd9c7~1'

Googling git rebase a blob yields no result. What should I do next?

I git push a repo and having this error:

remote: - GITHUB PUSH PROTECTION
remote:   —————————————————————————————————————————
remote:     Resolve the following violations before pushing again
remote:
remote:     - Push cannot contain secrets
remote:
remote:
remote:      (?) Learn how to resolve a blocked push
remote:      https://docs.github.com/code-security/secret-scanning/working-with-secret-scanning-and-push-protection/working-with-push-protection-from-the-command-line#resolving-a-blocked-push
remote:
remote:      (?) This repository does not have Secret Scanning enabled, but is eligible. Enable Secret Scanning to view and manage detected secrets.
remote:      Visit the repository settings page, https://github.com/QuaCau-TheSphere/BV-ton-tai-trong-the-gioi-tu-ban/settings/security_analysis
remote:
remote:
remote:       —— GitHub Personal Access Token ——————————————————————
remote:        locations:
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:          - blob id: 1fbb1eec3113333f234104065cc2da11870dd9c7
remote:
remote:        (?) To push, remove secret from commit(s) or follow this URL to allow the secret.
remote:        https://github.com/QuaCau-TheSphere/BV-ton-tai-trong-the-gioi-tu-ban/security/secret-scanning/unblock-secret/2rQiwV6UWe7GhaSG1sleJtFzFHX
remote:
remote:
remote:     ——[ WARNING ]—————————————————————————————————————————
remote:      Scan incomplete: This push was large and we didn't finish on time.
remote:      It can still contain undetected secrets.
remote:
remote:      (?) Use the following command to find the path of the detected secret(s):
remote:          git rev-list --objects --all | grep blobid
remote:     ——————————————————————————————————————————————————————

I follow Working with push protection from the command line - GitHub Docs and do:

git rebase -i 1fbb1eec3113333f234104065cc2da11870dd9c7~1

The error:

error: object 1fbb1eec3113333f234104065cc2da11870dd9c7 is a blob, not a commit
fatal: invalid upstream '1fbb1eec3113333f234104065cc2da11870dd9c7~1'

Googling git rebase a blob yields no result. What should I do next?

Share Improve this question edited 4 hours ago dani-vta 6,7357 gold badges49 silver badges65 bronze badges asked 4 hours ago OokerOoker 2,9705 gold badges38 silver badges79 bronze badges 1
  • 1 You'd need to use the hash/ref of the commit the blob has been introduced in, not the hash of the blob itself. – dan1st Commented 4 hours ago
Add a comment  | 

1 Answer 1

Reset to default 1

The step 4 of the guide you've linked says

Start an interactive rebase with git rebase -i <COMMIT-ID>~1.

Instead, you've provided the SHA1 of the blob containing the secret, not the SHA1 of the commit to rebase from. If you need to know the commit(s) that contain the incriminated blob, you can run git log with the --find-object option supplied with the blob's id.

git log --all --find-object=1fbb1eec3113333f234104065cc2da11870dd9c7

If the command returns only one commit, rebase from the commit prior to it, otherwise rebase from the commit prior to the furthest commit in the history returned.

git rebase -i <furthest-commit-id>~1

本文标签: gitHow to remove secrets from a blobStack Overflow