I made a shallow clone of a repository with git clone --depth=1
. I made some changes... apparently without understanding the complications of shallow clones... and now want to push the new project to a new remote.
On my main dev machine:
git clone --depth=1 file://old_project new_project
cd new_project
# made a handful of commits here....
I now want to push the project to another machine. On that remote machine I did:
git init --bare new_project.git
And then back on my machine:
git remote remove origin
git remote add origin ssh://<remote host>/path/to/repos/new_project.git
Now when I try to push
the project, I get:
fatal: protocol error: expected old/new/ref, got 'shallow 7f6a256...'
fatal: The remote end hung up unexpectedly
Counting objects: 49299, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (44533/44533), done.
error: pack-objects died of signal 13
error: failed to push some refs to '<my new remote>'
What I'd like to do is have the new repo contain the history from the initial shallow clone onward, but still retain the changes made after that point. In other words, I don't want to "unshallow" the branch and pull all the previous history.
Is there a way forward without with just deleting .git
directory from the project and starting over?
My machine is running git 1.9.1. The remote is running 1.7.11.7. I can probably update my side with no ill effects, but not the remote as it hosts several other projects that I don't want to risk disrupting.