Help Center/ CodeArts Repo/ FAQs/ FAQs/ How Do I Prevent Files Containing Secrets from Being Pushed to a Repository?
Updated on 2023-05-06 GMT+08:00

How Do I Prevent Files Containing Secrets from Being Pushed to a Repository?

Background

  • You can go to the repository details page, choose Settings > Commit Rules, and select Files containing secrets cannot be committed.
  • CodeArts Repo will refuse push attempts when the name of file to be pushed matches the regular expressions listed below.

This rule does not apply to files that have been pushed.

The following table lists the regular expressions for restricting pushes of files containing secrets and provides some file name examples.

Regular Expression

File Name Example

(ssh|config)\/(personal|server)_(rsa|dsa|ed\d+|ecdsa)

ssh_server_rsa

_rsa$

id_rsa

_dsa$

id_dsa

_ed25519$

id_ed25519

_ecdsa$

id_ecdsa

\.(pem|key)$

secret.key privatekey.pem

"[._]history$"

.bash_history