git 添加远程仓库并将第一次本地库的已有所有内容推送到远程库上遇到的一个错误

按照廖雪峰的git教程中的添加远程仓库这节中遇到的问题 (廖雪峰git教程该节链接链接描述)

在git shell操作如下,便出现了该错误提示(本地该仓库已有.git隐藏目录和readme.txt、LICENSE文件)

D:\wamp64\www\test [master]> git remote add origin [email protected]:yunshancangcang/test.git
D:\wamp64\www\test [master]> git push -u origin maste
error: src refspec maste does not match any.
error: failed to push some refs to '[email protected]:yunshancangcang/test.git'

于是当时搜到答案有 需要 add 、commit(此前我在本地已经过add和commit即工作区与版本区文件应该一致)
因此错误并没有解决

D:\wamp64\www\test [master]> git add readme.txt
D:\wamp64\www\test [master]> git add LICENSE
D:\wamp64\www\test [master]> git commit -m"first"
On branch master
nothing to commit, working tree clean
D:\wamp64\www\test [master]>  git push -u origin maste
error: src refspec maste does not match any.
error: failed to push some refs to '[email protected]:yunshancangcang/test.git'

于是再搜到一个网页大概知道问题所在 (该网页链接描述)
但按照该方法并没有解决错误

D:\wamp64\www\test [master]> git pull --rebase origin master
Warning: Permanently added 'github.com,192.30.255.***' (RSA) to the list of known hosts.
fatal: Couldn't find remote ref master
D:\wamp64\www\test [master]> git pull origin master
Warning: Permanently added 'github.com,192.30.255.***' (RSA) to the list of known hosts.
fatal: Couldn't find remote ref master

于是往本地仓库手动添加了README.me文件
,错误解决了,push成功。

D:\wamp64\www\test [master +1 ~0 -0 !]> git push -u origin master
Warning: Permanently added 'github.com,192.30.255.***' (RSA) to the list of known hosts.
Counting objects: 19, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (19/19), 1.56 KiB | 0 bytes/s, done.
Total 19 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), done.
Branch master set up to track remote branch master from origin.
To github.com:yunshancangcang/test.git
 * [new branch]      master -> master

你可能感兴趣的:(错误,git)