'git remote add' 是否只为同一个存储库创建别名?
Does 'git remote add' create just aliases for the same repository?
当我在我的 gitlab 中创建一个新项目时,我为服务器中的存储库获得一个默认名称 origin
。
然后我可能会使用 git remote add [name] [url]
创建几个所谓的远程存储库。如果我输入 git remote
,我只会得到以下内容:
$ git remote
name1
name2
origin
实际上我在gitlab中只能看到一个仓库,即项目,其他的在哪里?所以在我使用 git push name1
之后,它是 push
到所有远程存储库还是仅 push
到 origin
?与不加名字的方式相比,我看不出有什么区别。
git remote add [name] [url]
添加 name
作为当前本地存储库 中 url
的别名。别名被命名为 "a remote"(名词)。没有远程(我必须使用 "distant" 这个词来避免使用 "remote")服务器被联系,更不用说没有创建远程存储库了。
after I use git push name1
, does it push to all of the remote repositories or just push to the origin
?
语法是
git push [remote [ref]]
也就是说,你可以做 git push
(将默认引用推送到默认远程;取决于配置,但通常它会将当前分支推送到其上游远程,通常是 origin
) ;或者您可以 git push name1
明确命名遥控器;或者您可以 git push name1 master
命名远程和分支。
没有内置的方式推送到多个远程,但可以使用其他命令行工具。
当我在我的 gitlab 中创建一个新项目时,我为服务器中的存储库获得一个默认名称 origin
。
然后我可能会使用 git remote add [name] [url]
创建几个所谓的远程存储库。如果我输入 git remote
,我只会得到以下内容:
$ git remote
name1
name2
origin
实际上我在gitlab中只能看到一个仓库,即项目,其他的在哪里?所以在我使用 git push name1
之后,它是 push
到所有远程存储库还是仅 push
到 origin
?与不加名字的方式相比,我看不出有什么区别。
git remote add [name] [url]
添加 name
作为当前本地存储库 中 url
的别名。别名被命名为 "a remote"(名词)。没有远程(我必须使用 "distant" 这个词来避免使用 "remote")服务器被联系,更不用说没有创建远程存储库了。
after I use
git push name1
, does it push to all of the remote repositories or just push to theorigin
?
语法是
git push [remote [ref]]
也就是说,你可以做 git push
(将默认引用推送到默认远程;取决于配置,但通常它会将当前分支推送到其上游远程,通常是 origin
) ;或者您可以 git push name1
明确命名遥控器;或者您可以 git push name1 master
命名远程和分支。
没有内置的方式推送到多个远程,但可以使用其他命令行工具。