[英]Change default remote for git-tfs repository
I am working against the customer's on premises TFS server using the git-tfs bridge.我正在使用 git-tfs 桥与客户的本地 TFS 服务器进行工作。 Yesterday they migrated their installation to a new version + changed the URL of the server, migrating all the history and the work items to a new instance.
昨天,他们将安装迁移到新版本 + 更改了服务器的 URL,将所有历史记录和工作项迁移到新实例。
Is there a way to remap my existing git repository to the new default remote?有没有办法将我现有的 git 存储库重新映射到新的默认远程?
I tried to manually edit the url property of the [tfs-remote "default"] so it points to the new address and run every possible cleanup*
command.我尝试手动编辑[tfs-remote "default"]的url属性,使其指向新地址并运行所有可能的
cleanup*
命令。 However, on a fetch attempt there is a bootstrapping process adding a new tfs-remote with the old URL to the config file.但是,在fetch尝试中,有一个引导过程将带有旧 URL 的新tfs-remote添加到配置文件中。
You've got 2 solutions:你有2个解决方案:
The first , which should be the easier.第一个,应该更容易。 But, because git-tfs has evolved a lot since it was implemented, I don't know if it still work even if it should...
但是,因为 git-tfs 自实施以来已经发展了很多,我不知道它是否仍然有效,即使它应该......
Second, that will work for sure, is to update the metadata of the commit corresponding to last changeset fetched from the old TFS.其次,这肯定会起作用,是更新与从旧 TFS 获取的最后一个变更集相对应的提交的元数据。 It is used by git-tfs to bootstrap the new tfs-remote when none is found in the
gitconfig
file.当
gitconfig
文件中没有找到时,git-tfs 使用它来引导新的 tfs-remote。
Amend the git commit and replace the url in the metadata (something looking like that: git-tfs-id: [https://tfs.codeplex.com:443/tfs/TFS16]$/vtccds/trunk;C26497
) to point to the new TFS.修改 git commit 并替换元数据中的 url(看起来像这样:
git-tfs-id: [https://tfs.codeplex.com:443/tfs/TFS16]$/vtccds/trunk;C26497
)指向到新的 TFS。
Create a backup of your original .git/config
file:创建原始
.git/config
文件的备份:
cp .git/config .git/config.bak
Remove all the [tfs-remote]
settings in the .git/config
file.删除
.git/config
文件中的所有[tfs-remote]
设置。
Just do a normal git tfs fetch
from the command line.只需从命令行执行正常的
git tfs fetch
。
Thanks to Philippe for his answer... I would add that if you work with severl branches you need to update the config entry for each branc and add a感谢 Philippe 的回答...我想补充一点,如果您使用 severl 分支,则需要更新每个分支的配置条目并添加一个
legacy-urls = http://old-url:8080/tfs/Projects
for each one, like对于每一个,比如
[tfs-remote "Project/branch/..."]
url = http://newurl:8080/tfs/Projects
repository = ....
legacy-urls = http://old-url:8080/tfs/Projects
This will allow git-tfs to accept the checkin of these branches.这将允许 git-tfs 接受这些分支的签入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.