在git中,远程添加源与远程设置URL源之间有什么区别

时间:2020-05-10 19:12:21

标签: git

我正在以下本地仓库中进行操作;还清除远程存储库(即来源):

git init

然后在下面,如果不存在,将创建“起源”:

git remote add origin [repo-url]

否则,您可以使用set-url子命令来编辑现有的遥控器:

git remote set-url origin [repo-url]

此外,您可以使用来检查现有的遥控器

git remote -v

1 个答案:

答案 0 :(得分:3)

git remote add <name> <url>的文档状态

<name>处的存储库添加名为<url>的远程服务器。

git remote set-url <name> <newurl> [<oldurl>]

更改遥控器的URL。将与正则表达式<name>匹配的远程<oldurl>的第一个URL(如果没有给出<oldurl>的话则设置为第一个URL)为<newurl>

如果要添加远程URL,请使用git remote add <name> <url>进行简化,如果要更新现有的远程名称,请使用git remote set-url <name> <newurl> [<oldurl>]

相关问题