本地关联的就是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 git@github.com: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 git@github.com: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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值