如何查找或更改 Git 存储库服务器的 url
我在 Ubuntu 服务器上安装了 Git 和 Gitosis,该服务器停放了 3 个域名。我如何知道 Git 使用这些域名中的哪些来构建 Git 访问 url,例如: git@xxxxxxxx/repository.git 在哪里可以设置这个 xxxxxxx 值?预先感谢您,Git 看起来很棒。
I've installed Git and Gitosis on Ubuntu server which has 3 domain names parked. How do I know, which of these domain names are used by Git to construct Git access url, like for example, this: git@xxxxxxxx/repository.git Where can I set up this xxxxxxx value? Thank you in advance, Git looks to be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
(1)至于域名——只要它们都解析到服务器IP,就没有关系。 Git 最终通过 SSH 连接,在本例中连接到您的 gitosis 服务器。如果您可以通过任何这些托管域通过 SSH 连接到您的计算机,则可以将其用作 git url。
我不相信 git 允许您列出每个远程的多个 url,因此如果您想列出所有三个(可能是最坏的情况),只需设置三个远程,每个远程都有一个与您的服务器不同的域。
(2) 这真的很简单。查看项目目录中的
.git/config
文件。您需要更新网址;例如,我正在使用 github :) 您还可以手动添加其他
遥控器
。跟踪上游分支也会将其信息附加到此文件中,例如上面的列表后面是 git 如何管理远程分支的跟踪。希望这有帮助。
干杯,迈克。
(1) As for the domain names - as long as they all resolve to the server IP, it shouldn't matter. Git ultimately connects over SSH, in this case to your gitosis server. If you can connect via SSH to your machine via any of those parked domains, you can use it as your git url.
I don't believe that git allows you to list multiple urls per remote, so if you want to have all three listed (worst case scenario perhaps) just setup three remotes, each with a different domain to your server.
(2) That's really simple. Check out your
.git/config
file inside your project directory.You need to update the url; for example, I'm using github :) You can also add other
remotes
manually. Tracking upstream branches will append their info to this file as well, for examplewhich follows the above listing is how git manages tracking of remote branches. Hope this helps.
Cheers, Mike.
只要这些域解析为相同的 IP,它们就应该可以工作。
Any of those domains should work as long as they resolve to the same IP.