windows 安装git并上传本地项目到远程库碰到的问题

来源:互联网 发布:运营书籍 知乎 编辑:程序博客网 时间:2024/06/06 09:12

      看到很多公司都是用git管理自己的项目,我们公司也是,不过用的是eclipse工具,但我想应该要掌握git的bash使用和命令用法,所以我今天就抽空自己去尝试了使用git上传项目

,根据网上查找的博客去安装、上传,期间碰到一些问题,就记录下来,以备以后再次碰到查看,也希望可以给大家带来帮助。

第一个问题:git上传下载文件是需要ssh加密的,所以必须要安装ssh。安装好后,还要在GitHub上创建ssh key,把本地生成的 .ssh目录下 id_ras.pub文件内容拷贝到GitHub的ssh key中。

第二个问题:在上传到远程库的时候碰到问题:

$ git push -u origin master
To github.com:**************.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:*************git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这个问题具体原因不知道,加上--allow-unrelated-histories就可以了,即 git push origin master--allow-unrelated-histories


原创粉丝点击