我在我的硬盘上(本地)克隆的USB键上有一个repo(起源)。我将“起源”转移到NAS,并成功测试了从这里克隆。
我想知道我是否可以在“本地”设置中更改“起源”的URI,所以它现在将从NAS中拖动,而不是从USB键。
到目前为止,我可以看到两个解决方案:
把一切推到USB起源,然后将其复制到NAS(这意味着由于NAS起源的新承诺而付出很多工作);添加一个新的远程到“本地”并删除旧的(我担心我会打破我的历史)。
我在我的硬盘上(本地)克隆的USB键上有一个repo(起源)。我将“起源”转移到NAS,并成功测试了从这里克隆。
我想知道我是否可以在“本地”设置中更改“起源”的URI,所以它现在将从NAS中拖动,而不是从USB键。
到目前为止,我可以看到两个解决方案:
把一切推到USB起源,然后将其复制到NAS(这意味着由于NAS起源的新承诺而付出很多工作);添加一个新的远程到“本地”并删除旧的(我担心我会打破我的历史)。
当前回答
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
其他回答
查看您的特权
在我的情况下,我需要检查我的用户名
我有兩個或三個存储庫,有清潔的信件。
问题是我的许可我有两个私人 git 服务器和存储库
这个第二个帐户是该新 repo 的管理员,第一个是我的默认用户帐户,我应该允许首先
此分類上一篇: git remote set-url {name} {url}
git remote set-url origin https://github.com/myName/GitTest.git
它会很好,你可以尝试这个
对于SSH:
命令: git 远程设置 URL 起源 <ssh_url>
例如: git 远程设置 URL 起源 git@github.com:username/rep_name.git
对于HTTPS:
命令: git 远程设置 URL 起源 <https_url>
例如: git 远程设置 URL 起源 https://github.com/用户名/REPOSITORY.git
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
进入文件夹/repo,您要更改并执行下面的命令:
下面的命令将改变 repo 的 git fetch URL。
git remote set-url origin <your new url>.git
下面的命令将改变 repo 的 git push URL。
git remote set-url --push origin <your new url>.git
下面的命令检查上面的变化是否反映
git remote -v