I have some repository X. I would like to create a new empty repository that contains all of the files of X and the commit history as well. I have created a new repository remotely. I cloned the old repository X and I ran the following commands (I work with gitflow):
git flow init
git remote set-url origin $URL
git remote -u # Just to check
git push -u origin master
The last command failed with the following error:
To $URL
! [rejected] master -> master (fetch first)
error: failed to push some refs to '$URL'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The new remote repository is empty and does not have any files. It also has only master branch. What am I doing wrong?
Edit: I ran the following command:
git push --force -u origin master
The result:
Counting objects: 3751, done.
Delta compression using up to 36 threads.
Compressing objects: 100% (1131/1131), done.
Writing objects: 100% (3751/3751), 577.15 KiB | 322 KiB/s, done.
Total 3751 (delta 2615), reused 3727 (delta 2605)
error: unpack failed: error zeroPaddedFilemode: object a8025c7657985de77312ba1eea3dd926d50eae2f: mode starts with '0'
fatal: Unpack error, check server log
To $URL
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to '$URL'