git branch error: refname refs/heads/master not found

进行初始化git的时候:

 git init 
git add .
git branch -M master
git remote add origin git@github.com:xxx/xxxx.git
git push origin master

到了git branch -M master这一步,报错:

>git branch -M master
error: refname refs/heads/master not found
fatal: Branch rename failed

找了一大圈原因,结果大跌眼镜:
没有commit 成功!

# 找了一下历史操作,没有add!!!!
>git init
Initialized empty Git repository in ./.git/

>git commit -m "pyramids first commit!"
On branch master

Initial commit

Untracked files:
        README.md
        lena_gray.png
        pyramids_test.ipynb

nothing added to commit but untracked files present
#查看了一下status
>git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        README.md
        lena_gray.png
        pyramids_test.ipynb

nothing added to commit but untracked files present (use "git add" to track)

参考文章:src refspec master does not match any when pushing commits in git - git

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值