我在我的硬盘上(本地)克隆的USB键上有一个repo(起源)。我将“起源”转移到NAS,并成功测试了从这里克隆。
我想知道我是否可以在“本地”设置中更改“起源”的URI,所以它现在将从NAS中拖动,而不是从USB键。
到目前为止,我可以看到两个解决方案:
把一切推到USB起源,然后将其复制到NAS(这意味着由于NAS起源的新承诺而付出很多工作);添加一个新的远程到“本地”并删除旧的(我担心我会打破我的历史)。
我在我的硬盘上(本地)克隆的USB键上有一个repo(起源)。我将“起源”转移到NAS,并成功测试了从这里克隆。
我想知道我是否可以在“本地”设置中更改“起源”的URI,所以它现在将从NAS中拖动,而不是从USB键。
到目前为止,我可以看到两个解决方案:
把一切推到USB起源,然后将其复制到NAS(这意味着由于NAS起源的新承诺而付出很多工作);添加一个新的远程到“本地”并删除旧的(我担心我会打破我的历史)。
当前回答
git remote set-url origin git://new.location
(替代,打开.git/config,搜索 [远程“起源”),并编辑 url = 行。
你可以检查它工作,通过检查远程:
git remote -v
# origin git://new.location (fetch)
# origin git://new.location (push)
接下来的按钮,你将不得不指定新的上流分支,例如:
git push -u origin master
此分類上一篇: GitHub: 更改遠程 URL
其他回答
在 Git Bash 中,输入命令:
git 远程设置 URL 起源 https://NewRepoLink.git
输入信号
达尼
使用 gitbash git 远程 rm 起源命令删除起源 现在使用 gitbash git 远程 添加起源 添加新起源(从您的项目存储库中复制 HTTP 地址)完成
正如我们在这里看到的那样,
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
更改远程上流: git 远程设置 URL 起源 <url>
要添加更多升级: git remote 添加新位置 <url>
因此,您可以选择在哪里工作 git push 起源 <branch> 或 git push newplace <branch>
git remote -v
# View existing remotes
# origin https://github.com/user/repo.git (fetch)
# origin https://github.com/user/repo.git (push)
git remote set-url origin https://github.com/user/repo2.git
# Change the 'origin' remote's URL
git remote -v
# Verify new remote URL
# origin https://github.com/user/repo2.git (fetch)
# origin https://github.com/user/repo2.git (push)
更改远程的URL