将本地代码提交到github

最近练习了freemarker 作了个代码生成工具,想提交到github上,在本地进行了提交,执行以下些命令git

git initgithub

git add . *工具

git commit -m "commit"。ui

以后在github帐户中建立了新的repository(参考 http://blog.csdn.net/hanhailong726188/article/details/46738929 ),起名和本地项目名称一致叫freemarker。spa

开始执行上传代码操做以下:.net

1. git remote add origin https://github.com/baixiaodong/freemarker.git  显示正常
blog

执行 2. git pull origin master  提示错误 fatal: refusing to merge unrelated historie  以下图:rem

看意思是不相关拒绝合并。奇怪,明明已经执行关联了呀。 因而从新执行了 git remote add origin ,提示fatal: remote origin already exists。 it

因而先执行了git remote rm origin。ast

再从新执行如上红色字的 一、 2 两步,第二步执行仍是一样的错误。查找资料提示说 是由于不一样仓库的缘由,若是要合并须要在pull是加参数为:--allow-unrelated-histories

再执行 git pull origin master  --allow-unrelated-histories, 终于进入了合并界面 。

附图:

最后执行,提示成功

再看github上,已经提交成功了

相关文章
相关标签/搜索