基本使用
推送步骤
初始化仓库
bash
git init配置用户名
bash
git config user.name "提交者的「用户名」(可自定义,通常是你的昵称 / 账号名)"配置邮箱
bash
git config user.email "提交者的「邮箱」(建议和 GitHub/GitLab 等平台的绑定邮箱一致)"💡 也可以设置全局用身份信息、邮箱!
提交者的「用户名」(可自定义,通常是你的昵称 / 账号名)
bash
git config --global user.name "昵称 / 账号名"提交者的「邮箱」(建议和 GitHub/GitLab 等平台的绑定邮箱一致)
bash
git config --global user.email "邮箱"暂存文件变更
bash
git add .提交暂存区变更并添加提交说明
bash
git commit -m "提交/修改描述"本地仓库和远程仓库进行绑定
bash
git remote add origin "创库地址"推送代码到仓库的master主分支
bash
git push -u origin master多仓库推送
添加多个仓库地址进行推送,可添加多个【比如双推】
bash
git remote set-url --add --push origin "创库地址"修改 fetch 地址(同时默认 push 地址)【拉取地址】
bash
git remote set-url origin "创库地址"删除某个仓库推送地址
bash
git remote set-url --delete --push origin "创库地址"查看当前 Git 仓库配置了哪些远程仓库地址
bash
git remote -v清空所有 推送地址,只保留这个新的
bash
git remote set-url --push origin "创库地址"