如何更改远程Git存储库的URI(URL)? - How to change the URI (URL) for a remote Git repository?

问题:

I have a repo (origin) on a USB key that I cloned on my hard drive (local). 我在硬盘驱动器(本地)上克隆的USB密钥上有一个回购(来源)。 I moved "origin" to a NAS and successfully tested cloning it from here. 我将“起源”移至NAS并成功测试了今后处克隆它的过程。 测试

I would like to know if I can change the URI of "origin" in the settings of "local" so it will now pull from the NAS, and not from the USB key. 我想知道是否能够在“本地”设置中更改“源”的URI,以便它如今能够从NAS而不是从USB密钥中提取。 spa

For now, I can see two solutions: 如今,我能够看到两种解决方案: .net

  • push everything to the usb-orign, and copy it to the NAS again (implies a lot of work due to new commits to nas-origin); 将全部内容推送到usb-orign,而后再次将其复制到NAS(因为对nas-origin的新提交,这意味着不少工做); rem

  • add a new remote to "local" and delete the old one (I fear I'll break my history). 在“本地”中添加新的遥控器,而后删除旧的遥控器(我担忧会破坏个人历史记录)。 get


解决方案:

参考一: https://stackoom.com/question/ACs8/如何更改远程Git存储库的URI-URL
参考二: https://oldbug.net/q/ACs8/How-to-change-the-URI-URL-for-a-remote-Git-repository
相关文章
相关标签/搜索