0

My topology:

W = Workstation w/VS.2017
R1 = Local TFS repo
R2 = Remote VSTS repo

For reasons discussed here, I'm running a TFS release step that mirrors R1 to R2 every time I sync W to R1.

(FYI the Invoke-git script from the other Q&A is causing an unspecified Git error when it sends STDERR to the text file, so I've decided to stop using that. I've opted instead to configure the TFS release step to not fail on STDERR.)

Here's the output from a TFS release step when mirroring from R1 to R2 after a sync from W to R1:

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'

This action omits several commits from R2 that exist on R1:

R1

Local TFS repo

R2

Remote VSTS repo

Here's a test mirror from W to 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

This test successfully sends all of the commits to R2.

And here's another TFS-spawned mirror from R1 to R2, AFTER the test mirror from W to R2:

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'

This is what I get when I run the mirror from R1 to R2 manually, after all of this:

D:\Agent\_work\37\s>git push --mirror Application
Everything up-to-date

But R2 is clearly not up to date. It's missing all commits subsequent to 67e6c4f3.

What am I doing wrong here? How can I get R2 to always be an exact copy of R1?

InteXX
  • 6,135
  • 6
  • 43
  • 80
  • 1
    Seems not update all, it should do something like `git push --all`,whatever just check if this article helps: [How to mirror a git repo to a new remote](https://makandracards.com/makandra/48818-how-to-mirror-a-git-repo-to-a-new-remote) – Andy Li-MSFT Jun 22 '18 at 08:41
  • X-Posted in the [Git-for-Windows mailing list](https://groups.google.com/d/msgid/git-for-windows/20180623180335.7yksmcihalhq2xli%40tigra) – kostix Jun 23 '18 at 18:10
  • @AndyLi-MSFT—I looked at the command sequence you suggested; to my untrained eye it appears to be more for a one-time permanent move than for a recurring synchronization. Would you agree? – InteXX Jun 27 '18 at 08:13

0 Answers0