git 添加遠程倉庫並將第一次本地庫的已有全部內容推送到遠程庫上遇到的一個錯誤

按照廖雪峯的git教程中的添加遠程倉庫這節中遇到的問題 (廖雪峯git教程該節連接連接描述html

在git shell操做以下,便出現了該錯誤提示(本地該倉庫已有.git隱藏目錄和readme.txt、LICENSE文件)git

D:\wamp64\www\test [master]> git remote add origin git@github.com: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 'git@github.com:yunshancangcang/test.git'

因而當時搜到答案有 須要 add 、commit(此前我在本地已通過add和commit即工做區與版本區文件應該一致)
所以錯誤並無解決github

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 'git@github.com:yunshancangcang/test.git'

因而再搜到一個網頁大概知道問題所在 (該網頁連接描述
但按照該方法並無解決錯誤shell

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成功。code

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
相關文章
相關標籤/搜索