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

来源:互联网 发布:指南针炒股软件官网 编辑:程序博客网 时间:2024/06/10 02:23

问题

Geek Lee@GEEKLEE-PC MINGW64 ~/learngit (master)$  git push -u origin masterfatal: 'origin' does not appear to be a git repositoryfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

解决

Geek Lee@GEEKLEE-PC MINGW64 ~/learngit (master)$ git remote add origin git@github.com:Geek-Lee/learngit.gitGeek Lee@GEEKLEE-PC MINGW64 ~/learngit (master)$ git push origin masterThe 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)? yesWarning: 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 git@github.com:Geek-Lee/learngit.git * [new branch]      master -> masterGeek 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)

0 0
原创粉丝点击