2

I need to mirror an upstream repository and use this as our local repository for all the projects. The criteria are:

  1. be able to pull/fetch from the upstream repository.

  2. people can clone this local repository and work on their own projects; and then they can push their projects/branches/changes to this local repository (we don't push back to the upstream repository).

  3. when people pull from this local repository, they should be able to see the changes in the upstream repository.

I tried to use:

git clone --bare

to clone the upstream repository and then:

git fetch

to update. But clones of this local repository won't see the updates. From what I can tell, in the local "bare" repository, "origin/master" got updated, but "HEAD" and "master" stays at where they were. Any ideas? Thanks!

poseid
  • 6,986
  • 10
  • 48
  • 78
ddwalker
  • 37
  • 1
  • 5

1 Answers1

5

Have you tried cloning with git clone --mirror?

From the git clone man page:

Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.

Billy Lazzaro
  • 476
  • 2
  • 13