命令行上传和更新本地项目到github的步骤

一、上传项目

0)如果项目本身有git残留,需要先移除旧的origin:

bash 复制代码
git remote remove origin

1)首次上传:

bash 复制代码
git remote add origin https://github.com/用户名/项目名称

2)然后推送:

bash 复制代码
git push -u origin main

二、更新项目

1)添加新增文件到git,以下代码是添加根目录的所有文件,注意 "." 前面要有空格:

bash 复制代码
git add .

2)添加说明注释(可选):

bash 复制代码
git commit -m "写一段对新增文件的说明注释"

3)推送到github(操作同上):

bash 复制代码
git remote add origin https://github.com/用户名/项目名称
git push -u origin main
相关推荐
极光技术熊15 小时前
Spring AI 从入门到精通:构建你的 AI 开发知识体系
后端·github
用户394839510755316 小时前
怎么让我的 Agent 真正"懂"我?——关于记忆、经验学习与预测的一些真实体验
github
远航_1 天前
git submodule
前端·后端·github
fthux1 天前
如果你用 Mac,那你可能需要 Noti Shift
macos·开源·github
程序员天天困2 天前
Loop Engineering 实战:/goal 命令让 AI 自己写完整项目
github
徐小夕2 天前
我们开源了一款“框架无关”的思维导图编辑器,3分钟集成到任意系统
前端·javascript·github
小爷毛毛_卓寿杰2 天前
我把 397B 的「Agentic 大脑」塞进了 Xinference,一键部署 Nex-N2
人工智能·架构·github
小爷毛毛_卓寿杰2 天前
我把一个 3B 模型塞进了 Xinference,然后它干掉了 DeepSeek V3.2
人工智能·开源·github
凌奕2 天前
别用文档约束你的 Agent:聊聊 Agent 开发流程的思想
llm·github·agent
HelloGitHub2 天前
《HelloGitHub》第 123 期
开源·github