Documents the steps taken to migrate P2CE's internal git repos to github with self-hosted LFS storage (literally just a gitlab instance lol).
This is done first because LFS is entirely separate from the git repo itself. Relying on .lfsconfig
makes it a bit tricky to mirror using "standard" procedures since there's typically no working tree available.
- Clone your repo
- Run
git lfs fetch --all
. We'll need all LFS objects here! - Create LFS storage repo somewhere. We just need an endpoint that implements the git LFS api (GitLab, .
- Put the following in .lfsconfig:
[lfs]
pushurl = https://git.example.org/me/myrepo-lfs.git/info/lfs
- Commit your .lfsconfig and push to the old remote.
- Run
git lfs push --all <remote> <branch>
This will upload your LFS objects to the specified mirror. NOTE: remote and branch do not matter at all here, just use origin master or whatever.
This will actually migrate your git repo!
- Clone bare repo:
git clone --bare <your url>
- cd into repo:
cd <your repo>
- Push git contents:
git push --mirror https://github.com/my-repo.git
--mirror
here will tell git to upload everything it can from the old remote. Branches and other refs will be pushed.
If you're using cloudflare do not proxy your LFS git server.
You didn't fetch absolutely all of the LFS objects, repeat the git lfs fetch --all
and git lfs push --all
steps. I've had this happen inexpicably, repeating those steps tends to fix it.
This can happen if you're trying to mirror from a full clone with more than 1 remote. Just make a bare clone and mirror from that as described in step 2.