|
|
|
@ -11,3 +11,20 @@ git remote add origin https://git.mashibing.com/msb_23480/first_msbwarehouse.git
|
|
|
|
|
git push -u origin main # 推送文件到远程仓库分支
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
问题
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
# 使用git push -u origin main 时出现错误
|
|
|
|
|
error: src refspec main does not match any
|
|
|
|
|
error: failed to push some refs to 'https://git.mashibing.com/msb_23480/first_msbwarehouse.git'
|
|
|
|
|
|
|
|
|
|
# 分析:GitHub 从今年 10 月 1 日起,在该平台上创建的所有新的源代码仓库将默认被命名为 “main”,而不是原先的"master"。
|
|
|
|
|
|
|
|
|
|
# 解决思路:把本地的 master 仓库名称修改为远端的 main
|
|
|
|
|
# 重命名命令: git branch -m oldBranchName newBranchName
|
|
|
|
|
# 解决:
|
|
|
|
|
git branch -m master main # 把本地的 master 仓库名称修改为远端的 main
|
|
|
|
|
# 然后再次提交
|
|
|
|
|
git push -u origin main
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|