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'

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

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

git add -A

接着提交,

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

之后执行,

git push -u origin master

执行后出现如下错误;

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.

上面提示我们需要执行

git pull

我们只需要执行

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

最后执行下面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

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

目录
相关文章
|
6月前
|
前端开发
【前端异常】Module build failed: Error: ENOENT: no such file or directory, scandir ‘G:\OPWeb\public\node_m
【前端异常】Module build failed: Error: ENOENT: no such file or directory, scandir ‘G:\OPWeb\public\node_m
68 0
|
2月前
|
Kubernetes 容器
使用kubeadm部署k8s报错:The kubelet is not running或者level=error msg="Handler for POST /v1.43/images/create returned error: Head \"https://us-west2-dock
使用kubeadm部署k8s报错:The kubelet is not running或者level=error msg="Handler for POST /v1.43/images/create returned error: Head \"https://us-west2-dock
|
8月前
解决 ERROR: cannot launch node of type [xxx]: can‘t locate node [xxx] in package [xxx]
解决 ERROR: cannot launch node of type [xxx]: can‘t locate node [xxx] in package [xxx]
334 0
|
9月前
|
JavaScript
Cannot read properties of undefined (reading ‘push‘)“ 报错 解决方法
一.首先这个报错的大致意思就是不能读取这个push方法,顾名思义就是使用这个方法的变量不是一个数组
1103 0
|
10月前
|
开发工具 git
Git 提示error:src refspec master does not match any
Git 提示error:src refspec master does not match any
86 0
|
11月前
|
数据采集 JavaScript 中间件
Node.js的nrm报错:internal/validators.js:125 throw new ERR_INVALID_ARG_TYPE
Node.js的nrm报错:internal/validators.js:125 throw new ERR_INVALID_ARG_TYPE
225 0
|
PyTorch 算法框架/工具
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=405 error=11 : invalid argument
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=405 error=11 : invalid argument
119 0
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=405 error=11 : invalid argument
src refspec xxx does not match any
src refspec xxx does not match any
|
前端开发
前端 scss文件报错 Base-level rules cannot contain the parent-selector-referencing character '&'. 解决办法
前端 scss文件报错 Base-level rules cannot contain the parent-selector-referencing character '&'. 解决办法
402 0
|
开发工具 git
关于 error: refname refs/heads/master not found 的问题
关于 error: refname refs/heads/master not found 的问题
674 0