From 4e3087b5521f1d44ef9a87c7fe798a1737eb9f89 Mon Sep 17 00:00:00 2001 From: Serendipity <510739832@qq.com> Date: Sat, 19 Aug 2023 09:02:35 +0800 Subject: [PATCH] second commit --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 406ef2c..0fb0317 100644 --- a/README.md +++ b/README.md @@ -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 +``` +