我一直在 GitHub 上開發一個公共 Visual Studio 專案,并將整個解決方案檔案夾與所有檔案一起上傳到存盤庫中。是否有我應該避免上傳到我的存盤庫的特定檔案或檔案夾?我聽說某些檔案夾可以包含快取或用戶資訊,但我仍然不確定要洗掉什么。
uj5u.com熱心網友回復:
我總是用這個網站生成我的 .gitignore 檔案。
如果您正在處理 ASP .Net 專案并且在您的 appsettings 中有資料庫的連接字串,請不要將其推送到 github。最好是生成一個 appsettings.example.json 并且只有結構和一些默認值。
uj5u.com熱心網友回復:
從廣義上講,您不應該在 github 上上傳以下內容:
任何不合法屬于您的內容,并且沒有一些開源許可。
可以生成的內容(例如目標檔案)。
特別是在你的情況下
您可以將源檔案放入 repo 中,但不能將源檔案中生成的內容放入。
此外,您不應該提交類檔案。您應該提交構建腳本,而不是構建生成的檔案。
最后請記住每個檔案 100MB 的大小限制。
另請閱讀 Hello World · GitHub 指南 ( https://guides.github.com/activities/hello-world/#what )
uj5u.com熱心網友回復:
您可以使用該.gitignore檔案忽略 IDE 的配置并構建快取和.env檔案。尤其是寫.env檔案是很有用的,.gitignore可以避免硬編碼導致的一些憑證泄露。
GitHub 和社區提供了通用.gitignore規則,參見https://github.com/github/gitignore。
例子:
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/316715.html
