命令行上传和更新本地项目到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
相关推荐
qianx771 小时前
KiteNote: 结合MicrosoftToDo和Obsidian优势的日常笔记软件
github
用户466969256971 小时前
AI编码账单砍60%:这个84K星的小工具,一行命令装好
github
简创AIGC陶先生1 小时前
【直播切片工作台】第22章:素材下载与 URL 重写
github
KevinAshen671 小时前
用 Go 修复旧下载工具:从接口 403 到凭证截断的完整复盘
go·github
miofly2 小时前
GitHub 今日推荐|Edge0:让大号 MoE 模型在一台 Mac 上流式跑起来
python·开源·github
shandianchengzi3 小时前
【记录】LLM|ChatGPT连接Github并管理
chatgpt·github
徐小夕3 小时前
JitOffice:把办公、AI 与审批装进同一个平台
前端·vue.js·github
徐小夕3 小时前
万字分享:为什么我们要自研Word解析引擎?JitWord 解析引擎 4.0 深度复盘
前端·vue.js·github
miofly5 小时前
GitHub 日榜趋势速报 | 2026-10-30
开源·github
wflynn14 小时前
GitHub 日榜趋势速报 | 2026-10-28
开源·github