Git——推送本地仓库到远程时出现错误“error: src refspec master does not match any”

解决

参考链接:https://www.jianshu.com/p/8d26730386f3

后续问题

以上参考解决方法写得很详细,但是我一步步运行后还是出现类似错误:
“error: src refspec master does not match any
error: failed to push some refs to 'e.coding.net:poowicat/vuepress_blog_rescoure
/blog-source.git'

于是回想起来,我之前把分支改成了master——>mian
然后按照参考博客解决方法重新执行一遍,把git push origin master改成git push origin main于是成功解决问题!!!

实际上

git init
这一步之后创建了一个名为.git的文件夹,不过它在默认状态下是隐藏的,系统将隐藏文件夹显示出来,可以看到有这样一个文件夹。
github上传项目方法:
git@e.coding.net:poowicat/vuepress_blog_rescoure/blog-source.git
在你的电脑上装好git

大致流程是:

1、在github上创建项目

2、使git clone git@e.coding.net:poowicat/vuepress_blog_rescoure/blog-source.git 克隆到本地

3、编辑项目

4、git add . (将改动添加到暂存区)

5、git commit -m "提交说明"

6、git push origin main 将本地更改推送到远程master分支(这里我已经将我的本project命名为main分支。

这样你就完成了向远程仓库的推送。

如果在github的remote上已经有了文件,会出现错误。此时应当先pull一下,即:

git pull origin master

然后再进行:

git push origin master

修改项目内容有更新在远程上

  1. git commit -m "修正图片路径"
  2. git pull
  3. git push
posted @ 2021-12-22 13:56  poowicat  阅读(4059)  评论(0编辑  收藏  举报