We migrated a repository from a Gitea server to BitBucket. When we try to clone via HTTPS we get the following error:
Error downloading object: : Smudge error: Error downloading : Object does not exist on the server: [404] Object does not exist on the server.
I followed this SO answer and I can clone, but when I do the git lfs pull
I get a bunch of
[404] Object does not exist
I then tried setting the lfs.url value as in this answer and then a git lfs pull
results in
Repository or object not found: /objects/batch, Check that it exists and that you have proper access to it.
After that, I saw some posts about issues with LFS and HTTPS so I tried cloning with SSH. (created new SSH key, added it to BitBucket, etc) This resulted in
error: external filter 'git-lfs filter-process' failed, fatal: : smudge filter lfs failed, warning: Clone succeeded , but checkout failed.
I then tried running git lfs install --skip-smudge
and cloning again via SSH. This worked, again, but the files are not accessible and when I run git lfs pull
now I get the following message multiple times:
batch request: git@bitbucket.org: Permission denied (publickey).: exit status 255
How do I fix this?
It appears Bitbucket's import tool does not import LFS objects. I ended up following the steps here to fix the problem (note that I updated step 9 to include origin
to fix an error).
First, create new a repo on Bitbucket and take note of the URL (or SSH endpoint) of the new repo. (I did not do this as I was fixing a repo I had already created)
In a terminal window, clone the existing project from GitHub:
git clone <URL>
Update your local repo with the metadata (branch names, tags, etc.) from the GitHub remote by running:
git fetch --all
Prior to migrating the repo to Bitbucket, we need to make sure that locally on this machine we have checked out all remote branches and have them in our local repo. To do this is a simple shell script that will checkout each branch of the repo to your local machine.
for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done
(Optional) If you are using Git LFS for large files, then you need to also fetch and pull down any LFS files hosted on your repo. You can do that through this command:
git lfs fetch origin --all
Now you are ready to push the repo up to the new Bitbucket address. First, we need to change the remote reference in our local Git repo to the new Bitbucket endpoint:
git remote set-url origin <BitBucket repo address>
After this, we do a git push to push all branches up to the remote on Bitbucket:
git push --all
We’re not done. The git push doesn’t push all the tags you might have on your current repository. To ensure the tags get migrated as well execute the following command:
git push --tags
(Optional) Finally, if you are using Git LFS, we need to push all the LFS files we downloaded in step 5 to the new repo. Do this by executing the following command:
git lfs push origin --all
After following these steps, we were able to clone without errors and access LFS files.