git本地上传到github服务器上面去

1. 检查本地是否安装了git  

git version

git version 2.10.0

创建一个远程仓库在git上面repository github会生成一个url连接

2.

$git init

Initialized empty Git repository in /Work/project/.git/

$git add .

$git commit -m '本地连接我的github'

[master (root-commit) 47ec6ff] 本地连接我的github

 1 file changed, 2 insertions(+)

 create mode 100644 init/initday170702.php

$git remote add origin https://github.com/sql1314/sql1314for20170702.git       ####在本地仓库添加一个远程仓库,并将本地的master分支跟踪到远程分支

 

$git pull origin master

fatal: refusing to merge unrelated histories

解决方案

我在Github新建一个仓库,写了License,然后把本地一个写了很久仓库上传。因为他们是两个不同的项目,要把两个不同的项目合并,git需要添加一句代码,在git pull,这句代码是在git 2.9.2版本发生的,最新的版本需要添加--allow-unrelated-histories

$git pull origin master --allow-unrelated-histories

From https://github.com/sql1314/sql1314for20170702

 * branch            master     -> FETCH_HEAD

Merge made by the 'recursive' strategy.

 README.md | 2 ++

 1 file changed, 2 insertions(+)

 create mode 100644 README.md

 

$git push origin master

 

okay  好了

转载于:https://www.cnblogs.com/pretty_c_a_t/p/7106309.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值