git走代理、更换远端仓库

走代理

git config --global http.proxy 'socks5://10.95.54.219:1080'

删除代理

git config --global --unset http.proxy

更换远端仓库

git remote rm origin
git remote -v
git remote add origin https://git-biz.xxxes.cn/xxx/gloxxxle/xxxcloud.git
git remote -v
git config -l

删除原有remote新增remote的话,需要拉取一下,获取新remote的分支信息,才能设置 --set-upstream-to 不然会报错

error: the requested upstream branch 'origin/web_dev' does not exist
hint: 
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint: 
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.

报找不到这个分支,其实这个分支是存在的。拉取一下就可以正确设置了。

git fetch  
git branch --set-upstream-to=origin/web_dev
git branch --set-upstream-to=origin/report
git branch --set-upstream-to=origin/web_v2