如何查找或更改 Git 存储库服务器的 url

发布于 2024-11-06 02:37:04 字数 156 浏览 1 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

递刀给你 2024-11-13 02:37:04

(1)至于域名——只要它们都解析到服务器IP,就没有关系。 Git 最终通过 SSH 连接,在本例中连接到您的 gitosis 服务器。如果您可以通过任何这些托管域通过 SSH 连接到您的计算机,则可以将其用作 git url。

我不相信 git 允许您列出每个远程的多个 url,因此如果您想列出所有三个(可能是最坏的情况),只需设置三个远程,每个远程都有一个与您的服务器不同的域。

(2) 这真的很简单。查看项目目录中的 .git/config 文件。

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = [email protected]:my_awesome_app
    fetch = +refs/heads/*:refs/remotes/origin/*

您需要更新网址;例如,我正在使用 github :) 您还可以手动添加其他遥控器。跟踪上游分支也会将其信息附加到此文件中,例如

[branch "master"]
    remote = origin
    merge = refs/heads/master

上面的列表后面是 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.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = [email protected]:my_awesome_app
    fetch = +refs/heads/*:refs/remotes/origin/*

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 example

[branch "master"]
    remote = origin
    merge = refs/heads/master

which follows the above listing is how git manages tracking of remote branches. Hope this helps.

Cheers, Mike.

太傻旳人生 2024-11-13 02:37:04

只要这些域解析为相同的 IP,它们就应该可以工作。

Any of those domains should work as long as they resolve to the same IP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文