Skip to content

Instantly share code, notes, and snippets.

@kbrafford
Created July 18, 2020 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbrafford/bba81d2278cdf9afd7bd185f40e3a2be to your computer and use it in GitHub Desktop.
Save kbrafford/bba81d2278cdf9afd7bd185f40e3a2be to your computer and use it in GitHub Desktop.
How to copy a complete git repo
What I asked <<origin company>> to give us:
In order to clone the repositories and get the branches please have them follow
this procedure on each of the repos:
# Let's mirror the <<reponame>> repo:
git clone --mirror git@github.com/<<origin company>>/path/to/<<reponame>>.git <<reponame>>/.git
For each reponame.git provided:
mkdir reponame
move reponame.git reponame\.git
cd reponame\.git
git config --local --bool core.bare false
cd ..
git checkout master
cd ..
create reponame on bitbucket, no readme
git remote add bitbucket https://<<userid>>@bitbucket.org/<<newco>>/reponame.git
git push --all bitbucket
git push --tags bitbucket
git remote set-url origin https://<<userid>>@bitbucket.org/<<newco>>/<<reponame>>.git
At this point, the repo you've just processed should be ready for people to
clone and start working with. People who clone this should see no <<origin company>> cruft
in the basic mechanism. Internal submodules will still need to be dealt with.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment