error: src refspec master does not match any. 错误

简介:

添加远程仓库出现如下问题:

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/liyihang/CorePython.git'
AI 代码解读

出现这个问题是因为本地仓库为空,我们只要在本地仓库中tianji

添加相关的文件即可。然后执行

git add -A
AI 代码解读

接着提交,

H:\Python_demo\CorePythonApplicationProgramming>git commit -m "chapter1"
[master (root-commit) 4c820d9] chapter1
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 chapter1/a.txt
AI 代码解读

之后执行,

git push -u origin master
AI 代码解读

执行后出现如下错误;

H:\Python_demo\CorePythonApplicationProgramming>git push -u origin master
To github.com:liyihang/CorePython.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:liyihang/CorePython.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
AI 代码解读

上面提示我们需要执行

git pull
AI 代码解读

我们只需要执行

H:\Python_demo\CorePythonApplicationProgramming>git pull --rebase origin master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
warning: no common commits
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:liyihang/CorePython
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: chapter1
AI 代码解读

最后执行下面git push命令即可;

H:\Python_demo\CorePythonApplicationProgramming>git push -u origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 319 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
Branch master set up to track remote branch master from origin.
To github.com:liyihang/CorePython.git
   1cd7481..c6ba515  master -> master
AI 代码解读

最后即可以添加远程仓库。

目录
打赏
0
0
0
0
1
分享
相关文章
剖析跨域问题始末及其解决方案——前端必备交叉知识(一)
跨域问题是前端开发中的常见挑战,了解并掌握不同的跨域解决方案能帮助你更高效地进行开发工作。本文对同源策略、跨域以及解决跨域的三种方案: CORS、JSONP、代理等跨域技术进行了介绍。选择合适的跨域解决方案非常重要。 在实际开发中,推荐优先考虑使用 CORS,因为它是现代浏览器支持的标准,且安全性较高。如果服务器无法修改,则可以考虑使用代理。如果是特殊情况,可以使用 JSONP,但要注意安全性。 只有锻炼思维才能可持续地解决问题,只有思维才是真正值得学习和分享的核心要素。如果这篇博客能给您带来一点帮助,麻烦您点个赞支持一下,还可以收藏起来以备不时之需,有疑问和错
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
384 0
【技术解析 | 实践】Havenask分析器
本次分享内容为Havenask的分析器,本次课程主要分为3部分内容(分析器介绍、解释分析器主要配置、实战演示),希望本次通过分享帮助大家更好了解和使用Havenask。
52323 3
【技术解析 | 实践】Havenask分析器
基于云效 AppStack,5 分钟搞定一个 AI 应用的开发和部署
区别于传统的流水线工具,本实验将带你体验云效应用交付平台 AppStack,从应用视角,完成一个 AI 聊天应用的高效交付。
56054 33
el-table复选框全部勾选以及勾选回显
el-table复选框全部勾选以及勾选回显
1373 0
低成本、高稳定性 |满帮集团 Eureka 和 ZooKeeper 的上云实践
充分了解和利用云的能力,能够让满帮技术团队从底层的持续投入中解脱出来,聚焦更上层的系统稳定性和工程效率,从架构层面实现更高的 ROI。
68278 75
阿里云魔搭社区发起ModelScope-Sora开源计划
阿里云魔搭社区在2024全球开发者先锋大会上启动ModelScope-Sora开源计划,聚焦中国多模态大模型研究,推出一站式工具链和Data-Juicer多模态数据处理系统,提升处理效率与质量。该计划还包括基础类Sora模型开源及沙盒实验室,以支持开发者迭代与训练。面对数据质量、安全、商业平衡及算力挑战,魔搭社区致力于推动AI创新,已汇聚众多模型与开发者。
1336 1
阿里云魔搭社区发起ModelScope-Sora开源计划
CSS实现流光线条效果
最近做了一个纯`css`实现的流光效果,在做这个需求之前在网上找了很多示例效果,结果都不能达到我想要的效果,于是自己动手实现了下面这样的。
2303 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等

登录插画

登录以查看您的控制台资源

管理云资源
状态一览
快捷访问