在Git hub中创建远程库Git
会提示你 :push an existing repository from the command line(从命令行推送现有存储库)
git remote add origin https://github.com/chengxianfeng/Git.git
git push -u origin master
然后会有远程库的用户名和密码的输入,完成后本地库就与远程库建立了联系。
修改本地库后直接用$ git push origin master
提交到远程库。
报错:
若本地库无修改是不会提交到远程库的
$ git push origin master
Everything up-to-date
提示:数据库无修改
连接时报错:
$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/chengxianfeng/Git.git'
原因:本地数据库中无数据。
远程库的克隆:
在创建远程库时选中Initialize this repository with a README
他允许计算机克隆这个库
在命令行输入
git clone https://github.com/chengxianfeng/kl.git
完成数据库的克隆
检查是否成功 cd kl
进入kl克隆库
完成克隆