Git Server上的域名更改

时间:2016-09-22 04:06:38

标签: git configuration settings git-config

在这里非常需要帮助。

Previosuly我的服务器的域名是git.abc.com,但现在要将域名更改为xyz.com,意味着成为git.xyz.com。

有关如何更改配置的任何想法?感谢。

2 个答案:

答案 0 :(得分:1)

在项目内打开文件.git/config并将git.abc.com替换为git.xyz.com

您的.git/config文件应如下所示:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = git+ssh://git@git.xyz.com/project/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*

您还可以运行下一个命令:

git remote set-url origin git+ssh://git@git.xyz.com/project/repo.git

答案 1 :(得分:0)

如果要更改本地克隆镜像上的存储库配置,可以执行以下步骤:

git remote # shows the remotes. we will pick "origin" for the example
git remote get-url origin # checks that this is indeed the correct remote URL
git remote remove origin # delete the remote from the remotes list
git remote add oringin <URL>

但是这会打破你的推/拉配置,你将不得不再次创建它们。这就是为什么有另一种选择:

git remote set-url origin <URL>

但这需要你知道两件事:

  • 远程名称
  • 远程网址

这就是我加入第一部分的原因。如果你不确定那些,前两个命令应该显示它们。

注意:如果您正在谈论服务器配置,如果没有更多信息,我无法帮助您。