如何更改遠程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
相關文章
相關標籤/搜索