git 远程与本地仓库合并
使用场景:在github等远程创建仓库后,因为用工具初始化本地项目可能也会在本地初始化gitee,此时就会需要合并远程和本地
步奏:
1.添加远程地址
git remote add origin
2.提交本地代码
git add . git commit
3.拉远程代码并合并冲突(因为在初始阶段直接合并不会出现太多事)
git pull origin master --allow-unrelated-histories
缺少参数选项导致的报错--- fatal: refusing to merge unrelated histories
4.推送并设置远程分支
git push --set-upstream origin 远程分支
缺少参数报错
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream,
use git push --set-upstream origin master To have this happen automatically
for branches without a tracking upstream,
see 'push.autoSetupRemote' in 'git help config'.
git 不区分大小写导致报错
fatal: will not add file alias '***含大写名或小写名' ('***含大写名或小写名' already exists in index)
处理
git config --global core.ignorecase false
git reset ***
git add *** 此时成功
git配置代理
//添加代理
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
//查看代理
git config --global --get http.proxy
git config --global --get https.proxy
//取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy