Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I believe I've found the answer for myself. It boils down to how you create the repository (and is my formal introduction to bare repos).</p> <p>In short, you can clone a repo the default way:</p> <pre><code>git clone https://github.com/foobar/myrepo.git </code></pre> <p>Which yields a local clone with working directory <em>myrepo</em>, within which is the <em>myrepo/.git</em> directory tree.</p> <p>Or you can clone it bare. <a href="https://stackoverflow.com/questions/3959924/whats-the-difference-between-git-clone-mirror-and-git-clone-bare">There are a couple of ways to do this</a>, but the --mirror option <s>appears to</s> yields the most complete replica:</p> <pre><code>git clone --mirror https://github.com/foobar/myrepo.git </code></pre> <p>This produces the <em>myrepo.git</em> directory (as one might see in gerrit or in gitolite) which has the same structure as the <em>myrepo/.git</em> directory above, but without the working directory bits.</p> <p><em>Note: I'll add that I'm not sure now whether a mirror is preferable to a bare clone with remote refs for the branches... I've got <a href="https://stackoverflow.com/questions/12398700/initializing-a-local-git-gerrit-repository-whats-the-optimal-way-to-do-this">another thread going</a> that inquires about this. For completeness, then, here's a way to create a bare clone with remote refs (the key being no working directory):</em></p> <pre><code>git init --bare ${LOCAL_REPO} cd ${LOCAL_REPO} git remote add origin ${REMOTE_URL} git fetch origin --tags git fetch origin </code></pre> <p>I tested the mirror idea as a one-off, cloning a repo straight into the local gerrit installation folder where <em>All-Projects.git</em> also lives, restarted gerrit and it sees the repo as well as all its branches. However, it's not the ideal way for gerrit. You should instead push from a local clone (preferably a bare one).</p> <p>So in gerrit, create a new empty project via the web admin interface (I didn't put an initial empty commit into it - not sure if that would cause problems), then from within a local mirror of the repo you're trying to replicate, push it to the new, empty gerrit repo along with the branches and tags:</p> <pre><code>git push &lt;gerrit_repo&gt; refs/heads/* refs/tags/* </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload