我可以将ssh/git URL重定向到另一个URL吗?例如:Git域名别名
[email protected]:company/project.git
将被重定向到
[email protected]:othercompany/project.git
我可以将ssh/git URL重定向到另一个URL吗?例如:Git域名别名
[email protected]:company/project.git
将被重定向到
[email protected]:othercompany/project.git
添加你需要
git add remote **remote1** [email protected]:company/project.git
git add remote **remote2** [email protected]:othercompany/project.git
现在你可以与2个遥控器并肩工作所需的遥控器。
gii pull remote1 brancha
git push remote2 brancha
这正是遥控器的用途。
阅读更多关于遥控器here
一旦您设置了遥控器,您可以并排使用它们来完成您的工作。
干净的方式显然是正确设置您的遥控器。但是,如果你真的想要一个别名主机与另一个,你可以在.ssh/config
这样做(读man ssh_config
)像
Host gitlab.com
HostName bitbucket.com
这将适用于SSH的所有用途。我建议反对它,因为有一天你最终会忘记这个别名,并且抱怨ssh gitlab.com
没有连接到gitlab.com
。
我不认为你可以别名路径到另一个虽然。