logo
5
2
WeChat Login

建议添加 .gitignore 文件(防泄露密钥/避免二进制产物)#4

Open
created 2 weeks ago
Edit

建议添加 .gitignore 文件

本仓库是一个 C++ 开发环境示例,建议添加 .gitignore 文件以帮助新手:

🛡️ 为什么需要 .gitignore

  1. 防止泄露密钥:避免意外提交 .envcredentials.json 等敏感文件
  2. 避免上传二进制构建产物__pycache__/*.pycdist/ 等不应进入版本控制
  3. 保持仓库整洁:让 git status 更清晰,减少噪音
  4. CNB 官方推荐:作为 Cloud Native Build 示例仓库,好的实践应从源头开始

📎 推荐模板(来自 GitHub gitignore 社区)

以下 .gitignore 模板来自 github/gitignore

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Linker files
*.ilk

# Debugger Files
*.pdb

# Compiled Dynamic libraries
*.so
*.dylib
*.dll
*.so.*


# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Build directories
build/
Build/
build-*/

# CMake generated files
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
Makefile
install_manifest.txt
compile_commands.json

# Temporary files
*.tmp
*.log
*.bak
*.swp

# vcpkg
vcpkg_installed/

# debug information files
*.dwo

# test output & cache
Testing/
.cache/


@wuzs 建议审核并添加此文件,让新手从第一个 commit 就养成良好的安全习惯 🚀

Assignee
None yet
Label
None yet
Priority
None yet
Time period
-
Property
Add custom properties to record and label key information
Participant