在开源之前,确保项目是可用且有一定结构的:
src/
、README.md
、LICENSE
)如果你还没有账号:https://github.com/
进入主页 → 点击右上角 ➕ → 选择【New repository】
填写关键信息:
.gitignore
文件(根据语言选择模板)点击【Create repository】
假设你已经在本地有一个项目文件夹:
cd your-project-folder
git init # 初始化Git
git remote add origin https://github.com/你的用户名/仓库名.git
git add .
git commit -m "Initial commit"
git push -u origin master
如果你之前已经初始化过并提交过代码,直接使用:
git remote add origin https://github.com/你的用户名/仓库名.git
git push -u origin master
这是项目的“门面”!
可以使用 Markdown 来美化排版
示例模板可参考:https://github.com/othneildrew/Best-README-Template
推荐使用的协议:
你可以在创建仓库时添加,或手动添加 LICENSE
文件
参考选择:https://choosealicense.com/
建议添加:
CONTRIBUTING.md
:如何参与贡献CODE_OF_CONDUCT.md
:行为准则你可以使用 GitHub 提供的模板:
【Settings → Community standards】里面有相关建议和自动生成按钮。
开源项目维护的关键是持续沟通 + 积极回应
python
web
AI
等,方便搜索pytest + coverage
)[本地项目准备]
↓
[创建 GitHub 仓库]
↓
[初始化 Git 并推送项目]
↓
[完善 README / LICENSE / 贡献指南]
↓
[鼓励社区参与和反馈]
↓
[持续维护和版本发布]