Mirror of my gerrit project

265 views
Skip to first unread message

Jen

unread,
Nov 16, 2012, 1:02:33 PM11/16/12
to repo-d...@googlegroups.com
I need to make some major changes to my gerrit git repository.  However, I would like to create a mirror of my current gerrit project, incase something
goes wrong I can also always revert back to the mirror.
 
what is the procedure to create a one time mirror (or a backup) of my gerrit git repo?
 
 
Thanks!

Magnus Bäck

unread,
Nov 16, 2012, 1:34:44 PM11/16/12
to repo-d...@googlegroups.com
On Friday, November 16, 2012 at 13:02 EST,
Unless it's enough to set tags that allow you to reset branches and
other tags to their original state, you can just make a copy of the
Git directory on the server. This will save the full state of the Git
repository itself, but state that Gerrit keeps in its internal database
(review scores and comments e.g.) won't be saved with this method.

If you don't have server access, cloning the Git will save the state of
all branches and tags that you have access to, except refs/meta/config
that isn't included in the default set of refs included in a clone.
But again, make sure you have read access to all refs before using this
method.

--
Magnus Bäck
ba...@google.com

David Pursehouse

unread,
Nov 16, 2012, 2:11:02 PM11/16/12
to repo-d...@googlegroups.com
> all branches and tags that you have access to, except refs/meta/config
> that isn't included in the default set of refs included in a clone

refs/notes/review is also not included by default.

Alex Blewitt

unread,
Nov 16, 2012, 2:41:17 PM11/16/12
to David Pursehouse, repo-d...@googlegroups.com
You can run 'git clone --mirror' which does what you expect.

       --mirror
           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.


Jen

unread,
Nov 19, 2012, 2:28:14 PM11/19/12
to repo-d...@googlegroups.com
Thank you !
 
If I do a manual copy of the git repo on the server (cp -R projname.git testing.git) , it wouldn't be a gerrit project unless I rename it back to the original project.
 
Cloning into 'testing'...
fatal: '/testing.git': not a Gerrit project
fatal: The remote end hung up unexpectedly
Is there a way to create a copy of ther gerrit project itself? 

Magnus Bäck

unread,
Nov 19, 2012, 2:51:09 PM11/19/12
to repo-d...@googlegroups.com
On Monday, November 19, 2012 at 14:28 EST,
Jen <jstan...@gmail.com> wrote:

> If I do a manual copy of the git repo on the server (cp -R
> projname.git testing.git) , it wouldn't be a gerrit project unless I
> rename it back to the original project.
>
> Cloning into 'testing'...
> fatal: '/testing.git': not a Gerrit project
> fatal: The remote end hung up unexpectedly
> Is there a way to create a copy of ther gerrit project itself?

Did you flush the project cache before attempting to clone this cloned
Git?

--
Magnus Bäck
ba...@google.com

Jen

unread,
Nov 19, 2012, 3:22:51 PM11/19/12
to repo-d...@googlegroups.com
I did not flush the project cache  prior to cloning. Do I need to do a flush-caches --all  ?
Thanks!

Magnus Bäck

unread,
Nov 19, 2012, 3:35:48 PM11/19/12
to repo-d...@googlegroups.com
On Monday, November 19, 2012 at 15:22 EST,
Jen <jstan...@gmail.com> wrote:

> On Monday, November 19, 2012 11:51:13 AM UTC-8, Magnus Bäck wrote:
>
> > Did you flush the project cache before attempting to clone this
> > cloned Git?
>
> I did not flush the project cache prior to cloning. Do I need to do a
> flush-caches --all ?

No, flushing the project cache will be enough.

--
Magnus Bäck
ba...@google.com

Jen

unread,
Nov 19, 2012, 4:18:23 PM11/19/12
to repo-d...@googlegroups.com
I tried
ssh -p 29418 <server> gerrit flush-caches --cache projects
 
However I still see the same error message:
Cloning into 'testing'...
fatal: '/testing.git': not a Gerrit project
fatal: The remote end hung up unexpectedly
If I try to create a new gerrit project from the Admin GUI, it says that a project with the same name exists.

David Pursehouse

unread,
Nov 19, 2012, 7:40:22 PM11/19/12
to Jen, repo-d...@googlegroups.com
> If I try to create a new gerrit project from the Admin GUI, it says that a project with the same name exists.

Do you see the project in the project list over SSH?

$ ssh -p 29418 <server> gerrit ls-projects


Jen

unread,
Nov 20, 2012, 12:33:18 AM11/20/12
to repo-d...@googlegroups.com
No, I do not see  the project when I run ssh -p 29418 <server> gerrit ls-projects.

Jen

unread,
Dec 3, 2012, 1:44:43 PM12/3/12
to repo-d...@googlegroups.com
I forgot to update the post. A gerrit restart did the trick.
Reply all
Reply to author
Forward
0 new messages