简体   繁体   English

当我推送到github时,所有版本的代码是否可用

[英]Are all versions of code available when I push to github

I'm still new with git, so please correct me if I'm using the wrong terminology. 我对git还是很陌生,所以如果我使用了错误的术语,请更正我。

I want to push a project to github. 我想将项目推送到github。 However, when I initialized the project, I added some files with sensitive information (database passwords). 但是,当我初始化项目时,我添加了一些带有敏感信息(数据库密码)的文件。 I have since removed the files and commited the change. 此后,我删除了文件并提交了更改。

If I push my code to github, will the older versions with the sensitive information be available? 如果我将代码推送到github,是否可以使用带有敏感信息的旧版本? Or does it only push the current version? 还是只推送当前版本?

Yes, even though you deleted it, older versions of the sensitive files will still be available. 是的,即使删除了它,敏感文件的旧版本仍然可用。 Use this guide to purge all versions of those files from the repo. 使用本指南从存储库中清除这些文件的所有版本。

If you committed the files with the sensitive information, then yes. 如果使用敏感信息提交了文件,则可以。 The entire repository from your machine will be copied to github - and every file you have ever committed is in the repository on your machine. 您机器上的整个存储库将被复制到github-并且您曾经提交的每个文件都在您机器上的存储库中。

If you want to keep the whole history on github except for those files, you can use purge . 如果要将除这些文件之外的全部历史记录保留在github上,可以使用purge Or, you could start a new repository based on the current state of the files. 或者,您可以根据文件的当前状态启动新的存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM