2016-09-22 170 views
2

在这里非常需要帮助。Git服务器上的域名更改

以前我的服务器的域名是git.abc.com,但现在要把域名改成xyz.com,意思是变成git.xyz.com。

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

回答

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://[email protected]/project/repo.git 
    fetch = +refs/heads/*:refs/remotes/origin/* 

您也可以运行一个命令:如果你想改变一个本地克隆镜像存储库配置

git remote set-url origin git+ssh://[email protected]/project/repo.git 
+0

但我只看到这一点。 [芯] repositoryformatversion = 0 FILEMODE =真 裸=假 logallrefupdates =真 – user548682

+0

@ user548682增补'的.git/config'文件例子。 –

+0

我的文件不显示abc.com,它只显示/gitProject/abc.git。 – user548682

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> 

但是,这将bre ak你的推/拉配置,你将不得不再次创建它们。这就是为什么有一个替代方法:

git remote set-url origin <URL> 

然而,这将需要你知道两件事情:

  • 远程名称
  • 远程URL

这就是为什么我列入第一部分。如果你不确定这些,前两个命令应该显示它们。


注意:如果你在谈论服务器配置,我不能帮你没有更多的信息。