赞
踩
项目更换了仓库地址,Python工程和Java工程(均适用)不重新 git clone 进行克隆仓库,直接切换新的地址。以下实现Git查看当前仓库地址以及Git切换新的仓库地址
方式一:git remote -v
示例:
D:\PythonProject>git remote -v
origin https://github.com/Xxxxxxxx/Xxxxxx.git (fetch)
origin https://github.com/Xxxxxxxx/Xxxxxx.git (push)
方式二:git remote show origin
示例:
D:\PythonProject>git remote show origin
* remote origin
Fetch URL: https://github.com/Xxxxxxxx/Xxxxxx.git
Push URL: https://github.com/Xxxxxxxx/Xxxxxx.git
HEAD branch: master
Remote branches:
master tracked
Local branches configured for 'git pull':
master merges with remote master
Local refs configured for 'git push':
master pushes to master (up to date)
在 .git
文件所在目录下执行:
git remote set-url origin 新仓库地址
示例:
D:\PythonProject>git remote set-url origin https://github.com/Yyyyyyyyy/Yy.git
以上便将工程的原仓库地址 https://github.com/Xxxxxxxx/Xxxxxx.git 切换为新仓库地址 https://github.com/Yyyyyyyyy/Yy.git
可以 git pull origin 分支名
拉取代码啦。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。