I've been working on a public Visual Studio project in GitHub, and have been uploading the entire solution folder into the repository, with all files. Are there specific files or folders that I should refrain from uploading to my repository? I've heard that certain folders can contain cache or user information, but I'm still not sure what to remove.
CodePudding user response:
Broadly speaking, you should not upload on github following:
any content which does not legally belong to you, and which has no some open source license.
content which could be generated (e.g. object files).
Specifically in your case
You can put source files in the repo but not things generated from the source.
Also, you should not commit class files. You should commit your build scripts, but not files generated by the build.
Lastly keep in mind the size limitations of 100MB per file.
Read also Hello World · GitHub Guides (https://guides.github.com/activities/hello-world/#what)
CodePudding user response:
You can use the .gitignore
file to ignore the IDE's config and build cache and the .env
files. In particular, it is useful to write .env
file to .gitignore
to avoid some credential leaks caused by hard coding.
GitHub and the community provide common .gitignore
rules, see https://github.com/github/gitignore.
Example:
# 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