本地关联的就是github的远程库

问题

Geek Lee@GEEKLEE-PC MINGW64 ~/learngit (master)
$  git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

解决

Geek Lee@GEEKLEE-PC MINGW64 ~/learngit (master)
$ git remote add origin [email protected]:Geek-Lee/learngit.git

Geek Lee@GEEKLEE-PC MINGW64 ~/learngit (master)
$ git push origin master
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of know             n hosts.
Counting objects: 20, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (20/20), 2.22 KiB | 0 bytes/s, done.
Total 20 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), done.
To [email protected]:Geek-Lee/learngit.git
 * [new branch]      master -> master

Geek Lee@GEEKLEE-PC MINGW64 ~/learngit (master)
$

之所以为什么加上-u不成功呢?
廖大原话是由于远程库是空的,我们第一次推送master分支时,加上了-u参数,Git不但会把本地的master分支内容推送的远程新的master分支,还会把本地的master分支和远程的master分支关联起来,在以后的推送或者拉取时就可以简化命令。从现在起,只要本地作了提交,就可以通过命令:$ git push origin master把本地master分支的最新修改推送至GitHub,现在,你就拥有了真正的分布式版本库!
我的可能就是原来有东西。
强烈推荐廖雪峰老师的git与github教程,我也是在那里学的,重点是….中文版!生动有趣,通俗易懂。

[廖大的Git教程]
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

猜你喜欢

转载自blog.csdn.net/geekleee/article/details/52474015