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

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

目录
相关文章
|
7月前
|
编解码 数据处理
微信分享报错 wxlog:Error:fail to load Keychain status:-25300 解决办法
微信分享报错 wxlog:Error:fail to load Keychain status:-25300 解决办法
2427 0
|
7月前
|
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
|
7月前
|
计算机视觉 Python
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
175 0
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)
411 0
|
开发工具 git
Git 提示error:src refspec master does not match any
Git 提示error:src refspec master does not match any
【node报错解决方案】Error: Cannot find module http-errors
【node报错解决方案】Error: Cannot find module http-errors
525 0
【node报错解决方案】Error: Cannot find module http-errors
【问题记录】警告:warning.warn(‘Downloading:{}‘.format(url),DownloadWarning)
【问题记录】警告:warning.warn(‘Downloading:{}‘.format(url),DownloadWarning)
【问题记录】警告:warning.warn(‘Downloading:{}‘.format(url),DownloadWarning)
|
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
223 0
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=405 error=11 : invalid argument
未解决:运行EtherCalc出错:Error: Cannot find module 'zappajs'
未解决:运行EtherCalc出错:Error: Cannot find module 'zappajs'
86 0