Open ityulkanov opened 2 years ago
If a repo is cloned "normally" in $HOME/git/xyzzy-full/
, you should be able to do this:
cd $HOME/git
git clone --mirror xyzzy-full xyzzy-bare
The xyzzy-bare/
directory will be a "bare" copy of whatever repo exists in the xyzzy-full/
directory.
The reverse is also true. If you have a "bare" repo in $HOME/git/xyzzy-bare/
, you can do this:
cd $HOME/git
git clone xyzzy-bare xyzzy-full
The xyzzy-full/
directory will be a "normal" clone of whatever repo exists in the xyzzy-bare/
directory. It'll be a full working directory, you'll be able to git checkout
different branches/tags/etc.
In both cases, running git remote -v
in the directory should show you an origin
remote pointing to whatever local directory the repo was cloned from. Commands line git push
and git fetch
will "work" as if that other directory were a "server" (like GitHub).
Regarding using BFG to clean upn existing repo, you may want to try something like this:
git clone --mirror
to make a local "bare" copy of the repogit clone
to make a local "normal" copy, from the bare copy that BFG just cleaned upfind . -type f -size +50M
", to see if there's anything in the repo that GitHub would complain about.git remote add
to make it point to an empty GitHub repo, then git push
to upload everything.Something else I ran into ... if you used --convert-to-git-lfs
, you'll need to also run git lfs install
within the bare repo directory before running git push
, otherwise it won't know to upload the now-LFS-based files, to LFS.
Before the push to GitHub, I need to clean up some files that I've pushed to git sometime ago. I've stumbled on bfg, but can't figure out the correct way to do --mirror with local repo, since I only have a .git folder. I've tried running bfg being inside of a project file on a .git folder level, but that doesn't seem to work. Should I upload to GitHub first, and then do --mirror or there is a more elegant way to invoke bfg on a local repo? I'm sure I'm not the only one with the same question, but quick issues search doesn't yield any results.