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

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

目录
相关文章
|
4月前
|
消息中间件
ERROR 65639 --- [Container#0-217] o.s.a.r.l.SimpleMessageListenerContainer Failed to check/redeclare
ERROR 65639 --- [Container#0-217] o.s.a.r.l.SimpleMessageListenerContainer Failed to check/redeclare
59 0
解决 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]
653 0
|
JavaScript
Cannot read properties of undefined (reading ‘push‘)“ 报错 解决方法
一.首先这个报错的大致意思就是不能读取这个push方法,顾名思义就是使用这个方法的变量不是一个数组
1377 0
|
开发工具 git
Git 提示error:src refspec master does not match any
Git 提示error:src refspec master does not match any
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
318 0
|
数据采集 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
294 0
【node报错解决方案】Error: Cannot find module http-errors
【node报错解决方案】Error: Cannot find module http-errors
413 0
【node报错解决方案】Error: Cannot find module http-errors
|
JavaScript 索引
js中exec,test,match,search,split等方法的使用
exec:对string进行正则处理,并返回匹配结果.array[0]为原字符串,array[i]为匹配在整个被搜索字符串中的位置。 test:测试string是否包含有匹配结果,包含返回true,不包含返回false。
68 0
未解决:运行EtherCalc出错:Error: Cannot find module 'zappajs'
未解决:运行EtherCalc出错:Error: Cannot find module 'zappajs'
77 0
src refspec xxx does not match any
src refspec xxx does not match any