首页 > 其他分享 >git master 不存在

git master 不存在

时间:2023-09-23 21:34:02浏览次数:27  
标签:src 存在 git refspec does master branch 分支

How to Fix the "src refspec master does not match any" Error
如何修复“src refspec master不匹配任何”错误

Now you are aware that the master branch does not exist. The solution to this error is to either create a local and remote master branch that you can push the commit to or to push the commit to an existing branch – maybe main.
现在您知道该 master 分支不存在。此错误的解决方案是创建一个本地和远程 master 分支,您可以将提交推送到该分支,或者将提交推送到现有分支 - 也许 main 。

You can create a remote master branch on a Git managed website (like GitHub) or you can do that directly from your terminal like this:
您可以在 Git 托管网站(如 GitHub)上创建一个远程 master 分支,也可以直接从您的终端执行此操作,如下所示:

git checkout -b master

# add commit

git push origin master

These commands will create a master branch locally. And by pushing to origin master, the master branch will also be created remotely.
这些命令将在本地创建一个 master 分支。通过推送到 origin master , master 分支也将远程创建。

But if you do not want to create a master branch, you can use the existing default branch (which may be main) instead.
但是,如果您不想创建 master 分支,则可以改用现有的默认分支(可能是 main )。

Wrapping up 总结

So if you get the Error: src refspec master does not match any error when you try to push to master, the most viable reason is that the master branch does not exist.
因此,如果您在尝试推送到 master 时遇到 Error: src refspec master does not match any 错误,最可行的原因是该 master 分支不存在。

标签:src,存在,git,refspec,does,master,branch,分支
From: https://www.cnblogs.com/kz7430/p/17725097.html

相关文章

  • git commit 报错:找不到 python 3.8
    到这个问题的原因可能有很多,这里只是记录下针对我遇到这这跟题的原因及解决方法问题描述执行gitcommit命令,报错/usr/bin/env:‘python3.8’:Nosuchfileordirectory问题分析gitcommit命令本身不需要python,找不到python多半配置了hook去进行提交去的检查,例......
  • git设置ssh key 同时配置Gitee和GitHub
    背景:由于一直用gitee来git代码,并且一直通过ssh无密码连接本地和gitee远程仓库。最近想使用github的GitHubPages的部署功能,就不得不在github上建立远程仓库,并使用ssh方式来git代码。这个时候就发现,之前的ssh秘钥不能同时在gitee和github上使用。问题解决:之前的ssh秘钥还是用......
  • master、origin master和origin/master分别表示什么
    1.master指本地分支名2.originmasterorigin指远程名,master指远程仓库中的分支名两者连起来就是远程仓库中的分支名3.origin/master远程分支名,以斜杠连接起来,标识只是一个远程分支,即远程仓库中的分支在本地的一个副本4.相关git命令//从名为origin的远程上拉取名为master的......
  • Android Failed to resolve: com.github.PhilJay:MPAndroidChart:v3.1.0
    2022.3.1版本修改settings.gradledependencyResolutionManagement{repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories{maven{url"https://jitpack.io"}//Addthisrepositoryjcenter()//orotherrep......
  • HEAD detached from originmaster
    HEADdetachedfromoriginmaster参考文档:gitcommit时报错HEADdetachedfrom85e119dnothingtocommit,workingtreeclean问题解决-简书(jianshu.com)liuzonglin@LAPTOP-CGO0UV3JMINGW64/d/.github/java-dome((a0734b5...))......
  • git SSL certificate problem unable to get local issuer certificate
    gitSSLcertificateproblemunabletogetlocalissuercertificate这个问题是由于没有配置信任的服务器HTTPS验证。默认,cURL被设为不信任任何CAs,就是说,它不信任任何服务器验证。只需要执行下面命令就可以解决:gitconfig--globalhttp.sslVerifyfalse......
  • Git 基础使用
    简易的命令行入门教程:Git全局设置:gitconfig--globaluser.name"liuzonglin"#设置用户签名gitconfig--globaluser.email"[email protected]"#设置用户邮箱创建git仓库:mkdir<仓库名>cd<仓库名>gitinit#初始化本地库touchREADME.mdgitaddREADME.m......
  • Git版本控制
    Git版本控制注意:开始学习之前,确保自己的网络可以畅通的连接Github:https://github.com,这个是一个国外网站,连起来特别卡,至于用什么方式实现流畅访问,懂的都懂。其实版本控制在我们的生活中无处不在,比如你的期末或是毕业答辩论文,由于你写得不规范或是老师不满意,你的老师可能会让你......
  • ! [rejected] master -> master (fetch first)
    ![rejected]master->master(fetchfirst)原因Git仓库中已经有一部分代码,所以它不允许你直接把你的代码覆盖上去。远程仓库和本地仓库存在差异。一般都是因为你在码云创建的仓库有ReadMe文件,而本地没有,造成本地和远程的不同步,解决方法:方法一、同步1、gitpull......
  • git 删除本地、远程分支
     删除远程分支:gitpushorigin:branchName #删除远程分支 gitpushorigin--deletestark#删除远程分支stark  常用删除本地分支:gitbranch-dbranchName  #删除本地分支,强制删除用-D gitbranch-dstark   #删除本地stark分支  gitbranch-......