logo
5
1
WeChat Login

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

Open
created 2 weeks ago
Edit

建议添加 .gitignore 文件

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

🛡️ 为什么需要 .gitignore

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

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

以下 .gitignore 模板来自 github/gitignore

# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Code coverage profiles and other test artifacts
*.out
coverage.*
*.coverprofile
profile.cov

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
.env

# Editor/IDE
# .idea/
# .vscode/


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

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