.gitignore 避免按下 API 键的功能?
Function of .gitignore to avoid pushing of API keys?
您好,我将使用 MySQL Connector/Python 访问数据库中的一些数据。我看过guidelines not to hardcode the keys on to the code but use config.py
. I have also found that it can be done with JSON. My app will be served to Heroku. What's the use of .gitignore? On this example,他用的名字是databaseconfig.py
。但是在 .gitignore
文件中添加了一行 *config.py
。为什么不是*databaseconfig.py
?如果我必须将 JSON 配置文件添加到 .gitignore,那么等效的是什么?谢谢!
他在 .gitignore
中使用 *config.py
行,因为 git 将忽略每个以 config.py
结尾的文件,例如 dabaseconfig.py
,config.py
、networkconfig.py
和 testingtestingothertestconfig.py
都会被忽略(但例如 confignotcorrectformat.py
将 而不是 被忽略)。 *
是所谓的通配符,可以匹配任何内容。
如果您需要忽略 JSON 配置文件,您可以在 .gitignore
.
中使用行 *config.json
您好,我将使用 MySQL Connector/Python 访问数据库中的一些数据。我看过guidelines not to hardcode the keys on to the code but use config.py
. I have also found that it can be done with JSON. My app will be served to Heroku. What's the use of .gitignore? On this example,他用的名字是databaseconfig.py
。但是在 .gitignore
文件中添加了一行 *config.py
。为什么不是*databaseconfig.py
?如果我必须将 JSON 配置文件添加到 .gitignore,那么等效的是什么?谢谢!
他在 .gitignore
中使用 *config.py
行,因为 git 将忽略每个以 config.py
结尾的文件,例如 dabaseconfig.py
,config.py
、networkconfig.py
和 testingtestingothertestconfig.py
都会被忽略(但例如 confignotcorrectformat.py
将 而不是 被忽略)。 *
是所谓的通配符,可以匹配任何内容。
如果您需要忽略 JSON 配置文件,您可以在 .gitignore
.
*config.json