用VS2017上传项目到gitee,基本步骤如下:
第一步:在gitee上创建项目
第二步:初始化git仓库
E:\Develope\Material2017>git init
Reinitialized existing Git repository in E:/Develope/Material2017/.git/
第三步:添加远程仓库地址
E:\Develope\Material2017>git remote add origin /clementine/
第四步:在执行pull
4.1提示文件merge
E:\Develope\Material2017>git pull origin master
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /clementine/Material
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
error: The following untracked working tree files would be overwritten by merge:
Please move or remove them before you merge.
Aborting
按照提示删除md文件即可,再执行pull成功
E:\Develope\Material2017>git pull origin master
From /clementine/Material
* branch master -> FETCH_HEAD
4.2提示拒绝合并
E:\Develope\SqlServerDataToolkit8.26\SqlServerDataToolkit>git pull origin master
From /xxx
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
fatal: refusing to merge unrelated histories
遇到refusing to merge unrelated histories这个提示是因为两个仓库不同,发现refusing to merge unrelated histories,无法pull。要把两个不同的项目合并,git需要添加一句代码,在git pull,这句代码是在git 2.9.2版本发生的,最新的版本需要添加–allow-unrelated-histories
假如我们的源是origin,分支是master,那么我们 需要这样写
git pull origin master --allow-unrelated-histories
需要知道,我们的源可以是本地的路径
第五步:解决冲突
pull之后出现冲突,如果是首创项目,只有一个md文件,会报这个文件冲突,可以在VS2017里解决就,之后提交。
E:\Develope\SqlServerDataToolkit8.26\SqlServerDataToolkit>git pull origin master --allow-unrelated-histories
From /clementine/SSDT
* branch master -> FETCH_HEAD
Auto-merging
CONFLICT (add/add): Merge conflict in
Automatic merge failed; fix conflicts and then commit the result.
第六步:提交、合并
这时可以直接进VS2017里面用git工具操作了。
或者在GIT命令行:
git add -A
git commit -a -m “init”
git push origin master
补充内容
上传项目到开源中国码云的git基本操作
/mastery_nihility/article/details/53020481
关于pull报错的解决方案来源
/lindexi_gd/article/details/52554159