[React.js] Error: GH013: Repository rule violations found

[React.js] Error: GH013: Repository rule violations found

About Error

This error occurred when I git push -u origin main to push my commits.

The reason was because I wrote personal access token in the index.html file. I copied and pasted on there because it’s something I can never remember, but I will need it at some point in the future.

The problem is that github scans all these informations related to security issues, so they blocked my push.


Solution

  1. In the error message, there is a link that directs you to the webpage that asks you about the sensitive information in your file. Once you tell them a reason, they will allow your push.

  2. git push -f origin main -f means force. You can anyway push your files.

  3. Delete sensitive information. Github is a space where everyone can see your code (if your repo is public). So, it’s not a good idea to write sensitive information like a personal access token.