Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git镜像的问题_Git_Tfs_Azure Devops - Fatal编程技术网

Git镜像的问题

Git镜像的问题,git,tfs,azure-devops,Git,Tfs,Azure Devops,我的拓扑: W = Workstation w/VS.2017 R1 = Local TFS repo R2 = Remote VSTS repo 出于讨论的原因,我正在运行一个TFS发布步骤,该步骤在每次将W同步到R1时将R1镜像到R2 (仅供参考,另一个Q&A中的Invoke git脚本在将STDERR发送到文本文件时导致未指定的git错误,因此我决定停止使用该脚本。我选择将TFS发布步骤配置为在STDERR上不失败。) 以下是从W到R1同步后从R1镜像到R2时TFS发布步骤的输出: PO

我的拓扑:

W = Workstation w/VS.2017
R1 = Local TFS repo
R2 = Remote VSTS repo
出于讨论的原因,我正在运行一个TFS发布步骤,该步骤在每次将W同步到R1时将R1镜像到R2

(仅供参考,另一个Q&A中的
Invoke git
脚本在将STDERR发送到文本文件时导致未指定的git错误,因此我决定停止使用该脚本。我选择将TFS发布步骤配置为在STDERR上不失败。)

以下是从W到R1同步后从R1镜像到R2时TFS发布步骤的输出:

POST git-receive-pack (744 bytes)
Pushing to https://Personal%20Access%20Token:********@customer.visualstudio.com/Applications/_git/Application
To https://customer.visualstudio.com/Applications/_git/Application
  = [up to date]      master -> master
  = [up to date]      origin/develop -> origin/develop
  - [deleted]         Application/master
    c13bdc5..81ddbe0  origin/master -> origin/master
updating local tracking ref 'refs/remotes/Application/master'
此操作将忽略R1上存在的R2的多个提交:

R1

R2

这是从W到R2的测试镜像:

D:\Dev\Application>git push --mirror Application
Counting objects: 1, done.
Writing objects: 100% (1/1), 235 bytes | 235.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Analyzing objects... (1/1) (187 ms)
remote: Storing packfile... done (95 ms)
remote: Storing index... done (44 ms)
To https://customer.visualstudio.com/Applications/_git/Application
   67e6c4f..81ddbe0  master -> master
 * [new branch]      develop -> develop
 * [new branch]      Application/develop -> Application/develop
 * [new branch]      Application/master -> Application/master
POST git-receive-pack (885 bytes)
Pushing to https://Personal%20Access%20Token:********@customer.visualstudio.com/Applications/_git/Application
To https://customer.visualstudio.com/Applications/_git/Application
 = [up to date]      origin/develop -> origin/develop
 - [deleted]         develop
 + 81ddbe0...67e6c4f master -> master (forced update)
 - [deleted]         Application/develop
 + c13bdc5...67e6c4f Application/master -> Application/master (forced update)
   81ddbe0..3329b73  origin/master -> origin/master
updating local tracking ref 'refs/remotes/Application/develop'
updating local tracking ref 'refs/remotes/Application/master'
此测试成功地将所有提交发送到R2

这是另一个从R1到R2的TFS派生镜像,在从W到R2的测试镜像之后:

D:\Dev\Application>git push --mirror Application
Counting objects: 1, done.
Writing objects: 100% (1/1), 235 bytes | 235.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Analyzing objects... (1/1) (187 ms)
remote: Storing packfile... done (95 ms)
remote: Storing index... done (44 ms)
To https://customer.visualstudio.com/Applications/_git/Application
   67e6c4f..81ddbe0  master -> master
 * [new branch]      develop -> develop
 * [new branch]      Application/develop -> Application/develop
 * [new branch]      Application/master -> Application/master
POST git-receive-pack (885 bytes)
Pushing to https://Personal%20Access%20Token:********@customer.visualstudio.com/Applications/_git/Application
To https://customer.visualstudio.com/Applications/_git/Application
 = [up to date]      origin/develop -> origin/develop
 - [deleted]         develop
 + 81ddbe0...67e6c4f master -> master (forced update)
 - [deleted]         Application/develop
 + c13bdc5...67e6c4f Application/master -> Application/master (forced update)
   81ddbe0..3329b73  origin/master -> origin/master
updating local tracking ref 'refs/remotes/Application/develop'
updating local tracking ref 'refs/remotes/Application/master'
这是我手动运行从R1到R2的镜像时得到的结果,在所有这些之后:

D:\Agent\_work\37\s>git push --mirror Application
Everything up-to-date
但是R2显然不是最新的。它缺少
67e6c4f3
之后的所有提交


我做错了什么?如何让R2始终是R1的精确副本?

似乎不是全部更新,它应该执行类似于git push--all的操作,不管怎样,只要检查本文是否有帮助:X-post在@AndyLi-MSFT-I中,我查看了您建议的命令序列;在我未经训练的眼中,这似乎更多的是一次性的永久移动,而不是重复的同步。你同意吗?