如何解决failed to push some refs to git
2023-09-11 14:17:57 时间
方法
在使用git 对源代码进行push到gitHub时可能会出错,信息如下
![](https://upload-images.jianshu.io/upload_images/1327716-144138fab4b6def1.jpg)
如何解决failed to push some refs to git
此时很多人会尝试下面的命令把当前分支代码上传到master分支上。
$ git push -u origin master
但依然没能解决问题
![](https://upload-images.jianshu.io/upload_images/1327716-65ee79183877efef.jpg)
如何解决failed to push some refs to git
出现错误的主要原因是github中的README.md文件不在本地代码目录中
![](https://upload-images.jianshu.io/upload_images/1327716-3a006dc354a16173.jpg)
如何解决failed to push some refs to git
可以通过如下命令进行代码合并【注:pull=fetch+merge]
git pull --rebase origin master
![](https://upload-images.jianshu.io/upload_images/1327716-6680511c6a422bad.jpg)
如何解决failed to push some refs to git
执行上面代码后可以看到本地代码库中多了README.md文件
![](https://upload-images.jianshu.io/upload_images/1327716-bd399ac49fa6ad00.jpg)
如何解决failed to push some refs to git
![](https://upload-images.jianshu.io/upload_images/1327716-fb717bdb56f28c52.jpg)
如何解决failed to push some refs to git
此时再执行语句 git push -u origin master即可完成代码上传到github
[
![](https://upload-images.jianshu.io/upload_images/1327716-9303fdc6b4029b82.jpg)
如何解决failed to push some refs to git
http://jingyan.baidu.com/article/f3e34a12a25bc8f5ea65354a.html
相关文章
- gitee下载报错-fatal: Authentication failed for ‘https://git.weixin.qq.com
- Git Pull Failed Your local changes would be overwritten by merge.(git报错)
- Git:CentOS7安装git客户端,make: *** [configure] 错误 127
- 使用 Git 同步时出现gnutls_handshake() failed: Error in the pull function
- Git 常见错误 之 error:error: src refspec main does not match any/ error: failed to push some refs to 简单解决
- git clone时出现"fatal: unable to access 'https://myrepo.git/': server certificate verification failed. CAfile: /my-certificate CRLfile: none"时如何处理?
- git clone或者git pull时遇到gnutls_handshake() failed: An unexpected TLS packet was received.如何处理?
- git clone时报错“Failed to connect to 127.0.0.1 port 2453: Connection refused”如何处理?
- git克隆源码时提示fatal: HTTP request failed怎么办?
- Git(二)使用git管理文件版本(TortoiseGit )
- Git Pull Failed Your local changes would be overwritten by merge. Commit, stash or revert them to proceed
- vscode Git:failed to execute git
- PySe-016-Requests 访问 HTTPS 网站报错解决方法:SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
- idea中完美解决Error:java: Compilation failed: internal java compiler error的问题
- Jenkins+GitHub报错hudson.plugins.git.GitException: Failed to fetch from GitHub 443
- 浅析如何使用git reflog和git cherry-pick找回已删除的commit记录、Git cherry-pick简单用法
- Git 常见错误 之 error: src refspec xxx does not match any / error: failed to push some refs to 简单解决方法
- Linux下安装Git、git命令介绍
- install Ros error:curl: (7) Failed to connect to raw.githubusercontent.com port 443: 拒绝连接的解决方案
- ComposerDownloaderTransportException ... Failed to enable crypto,failed to open stream: operation failed