[GTALUG] Git/Gitolite Question

Myles Braithwaite me at mylesbraithwaite.com
Wed Mar 8 10:50:47 EST 2017


On Wed, Mar 8, 2017 at 10:39 AM, Peter King via talk <talk at gtalug.org> wrote:
> I have a repository cloned from an original master repository -- but
> the server it was taken from, hosting the original master repository
> with git/gitolite, is now defunct, leaving me with only my cloned
> repository.
>
> I have now set up another server running git and gitolite, and I can
> successfully log in via ssh, clone/pull/push the gitolite-admin repo,
> and add a new bare repo to that server by editing gitolite-admin, all
> as it should be.
>
> How do I take the old repository cloned from the defunct server and
> set it up as master on the new git/gitolite server? There are a few steps
> involved, and it isn't clear how or in what order to carry them out:
>
>   (1) put the old repository on the new git/gitolite server,
>       to be managed by gitolite
>
>   (2) make that repository on the new git/gitolite server to
>       be the master/origin from now on
>
> From looking at the documentation and googling around, it seems like
> I can accomplish (1) by just modifying the gitolite-admin on my local
> machine to add a "new" repository (namely the old cloned repository)
> to which I give myself access.  One thing I'm not clear about is
> whether I then put the old cloned repository in the proper place in
> my filesystem and then push the changes to gitolite-admin, or first
> push the changes so that there is a "new" empty repo created by
> gitolite, pull the empty repo, replace it with the old cloned repo,
> or what.
>
> Anyway, at some point in the process (after the above? in the middle?)
> I need to set git/gitolite up to point to the old cloned repository,
> now managed by gitolite, to be the orgin/master.  When?
>
> Sorry for the elementary questions, but I don't want to make any
> mistakes in re-situating the old cloned repository.  If anyone knows
> the answers and can tell me, preferably assuming that I'm a complete
> novice to git/gitolite, I'd appreciate it.  Thanks!

I think what you are asking could be accomplished with:

Rename the current origin remote to old-origin:

$ git remote rename origin old-origin

Create a new origin:

$ git remote add origin git at gitloite-server:repo.git

Push to the new repo and set as upstream:

$ git push --set-upstream origin master


More information about the talk mailing list