Reputation: 57
I'm using sourcetree and want to move my work along with its commit history to another account on source tree so more people can access it. It is a clone of another repo on the target account, but I need to show how it evolved so others can trace bugs.
I googled many different combinations, including this posts' exact title, but couldn't find ANYWHERE that tells you how to do this. All I get is unrelated searches about how to: create a repo
upload a new repo
upload an existing repo to new repo
clone an existing repo to new repo
but NOT how to:
clone an existing repo TO another repo
clone an existing repo AS BRANCH OF another repo
I know this can be done because I've done it before, but that time it was an 8 hour google session and I really don't want to go through that again...
Please help me!
Upvotes: 0
Views: 163
Reputation: 522499
I think you are getting bogged down with trying to copy your remote repository because you are insisting that the operation must be a direct copy on the server. This need not be the case. As this blog discusses, you can achieve what you want by cloning the repository locally, creating a new repository on BitBucket, and then simply pushing your code to this new repository:
# change directory to location of copy
mkdir NEW-PROJECT.git
cd NEW-PROJECT.git
# create a local copy of the repository
git clone --bare https://[email protected]/username/OLD-PROJECT.git
# now create an empty repository on BitBucket called NEW-PROJECT
# push your entire code base to this new repository
git push --mirror https://[email protected]/username/NEW-PROJECT.git
Upvotes: 1