793 B
793 B
配置用户信息 # 全局配置(所有项目生效) git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
# 仅当前项目配置(优先级更高)
git config user.name "Project Name"
-
初始化git
- git init
-
绑定远程仓库链接
- git remote add origin
-
创建新分支并且切换到新分支
- git ckeckout -b
-
添加所有文件
- git add .
-
添加提交说明
- git commit -m "Commit message"
-
提交到仓库
- git push origin
- git push origin main # 推送本地 main 分支到远程 origin
- git push -u origin feature/login # 第一次推送时设置上游分支(后续可用 git push 直接推送)