{"action":"created","issue":{"url":"https://api.github.com/repos/github/git-lfs/issues/1018","repository_url":"https://api.github.com/repos/github/git-lfs","labels_url":"https://api.github.com/repos/github/git-lfs/issues/1018/labels{/name}","comments_url":"https://api.github.com/repos/github/git-lfs/issues/1018/comments","events_url":"https://api.github.com/repos/github/git-lfs/issues/1018/events","html_url":"https://github.com/github/git-lfs/issues/1018","id":135110770,"number":1018,"title":"Can't push all objects to a new server","user":{"login":"rjbell4","id":375968,"avatar_url":"https://avatars.githubusercontent.com/u/375968?v=3","gravatar_id":"","url":"https://api.github.com/users/rjbell4","html_url":"https://github.com/rjbell4","followers_url":"https://api.github.com/users/rjbell4/followers","following_url":"https://api.github.com/users/rjbell4/following{/other_user}","gists_url":"https://api.github.com/users/rjbell4/gists{/gist_id}","starred_url":"https://api.github.com/users/rjbell4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjbell4/subscriptions","organizations_url":"https://api.github.com/users/rjbell4/orgs","repos_url":"https://api.github.com/users/rjbell4/repos","events_url":"https://api.github.com/users/rjbell4/events{/privacy}","received_events_url":"https://api.github.com/users/rjbell4/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-20T19:06:09Z","updated_at":"2016-02-21T18:42:47Z","closed_at":null,"body":"I changed the Git LFS server (by adding a .lfsconfig file), and I'm attempting to push all Git LFS objects to the new server.  I've done that with \"git push --all origin *mybranchname*\".  However, that fails verifying the uploaded object.\r\n\r\nThis is the diagnosis according to @technoweenie:\r\n>so i think whats happening is that the file was updated multiple times, and it's blowing up in ensureFile() because the actual file in the working directory is the latest version\r\n>which seems dumb. how would we not have run into this by now\r\n>should be an easy fix though\r\n\r\nCurrently we have only 50 commits, so I'm working around this issue checking out each commit and running the push on each one individually.  That seems to be working.  However, if we were to attempt things after 10,000 commits (for example), that would not have been practical."},"comment":{"url":"https://api.github.com/repos/github/git-lfs/issues/comments/186883670","html_url":"https://github.com/github/git-lfs/issues/1018#issuecomment-186883670","issue_url":"https://api.github.com/repos/github/git-lfs/issues/1018","id":186883670,"user":{"login":"technoweenie","id":21,"avatar_url":"https://avatars.githubusercontent.com/u/21?v=3","gravatar_id":"","url":"https://api.github.com/users/technoweenie","html_url":"https://github.com/technoweenie","followers_url":"https://api.github.com/users/technoweenie/followers","following_url":"https://api.github.com/users/technoweenie/following{/other_user}","gists_url":"https://api.github.com/users/technoweenie/gists{/gist_id}","starred_url":"https://api.github.com/users/technoweenie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/technoweenie/subscriptions","organizations_url":"https://api.github.com/users/technoweenie/orgs","repos_url":"https://api.github.com/users/technoweenie/repos","events_url":"https://api.github.com/users/technoweenie/events{/privacy}","received_events_url":"https://api.github.com/users/technoweenie/received_events","type":"User","site_admin":true},"created_at":"2016-02-21T18:42:47Z","updated_at":"2016-02-21T18:42:47Z","body":"Well, the good news is that the issue is not nearly as bad as I thought. There's a guard clause [at the top of `ensureFile()`](https://github.com/github/git-lfs/blob/a2781ff9cd5c38d0662218412910cbd14d296ed7/lfs/upload_queue.go#L80-L85), that returns early if the clean path doesn't exist.\r\n\r\nThe \"clean path\" is the full path to the content addressable filename, like \".git/lfs/objects/87/4b/874bacb5f6771c4aa238ff5421cb20725cbdd8cd3a63b8f138a82622fb4d2848\". Git LFS writes the object content here, and uploads it to the server.  In cases where you're trying to push content that didn't get cleaned properly, Git LFS will try to re-clean the file before blowing up.\r\n\r\nSo what happened in your case?\r\n\r\n> Expected binaries/archive/cemgui-app-data-bearcat.tar.gz to have an OID of 4f59c25f8a76d601d12691097432475691fc836a4338eb716345c03f8d7f5658, got 874bacb5f6771c4aa238ff5421cb20725cbdd8cd3a63b8f138a82622fb4d2848\r\n\r\nI think what happened is that you have a clone with only the latest version of \"binaries/archive/cemgui-app-data-bearcat.tar.gz\". As LFS is scanning commits to see what LFS objects it needs to upload, it found an older version of that file, with contents matching \"4f59c25f8a76d601d12691097432475691fc836a4338eb716345c03f8d7f5658\". For some reason, `.git/lfs/objects/4f/59/4f59c25f8a76d601d12691097432475691fc836a4338eb716345c03f8d7f5658` doesn't live in your local repository. So it tried to read the current contents of the file to build it, but the current version doesn't match the older version it's trying to upload.\r\n\r\nWhile the error message is correct, it is confusing. The fix is to recreate `.git/lfs/objects/4f/59/4f59c25f8a76d601d12691097432475691fc836a4338eb716345c03f8d7f5658` somehow. Since you're migrating from one LFS server to another, simply run `git lfs fetch --all` to download everything from the old server. That should fill the missing file in.\r\n\r\n> Currently we have only 50 commits, so I'm working around this issue checking out each commit and running the push on each one individually.\r\n\r\nThis works too, as running `git checkout` on each commit should download LFS objects from the origin remote.\r\n\r\nWhile this isn't a _bug_, there are a couple things I'd like to do:\r\n\r\n* Rewrite the error message to be more clear. It shouldn't take me this long to grok what's going on :)\r\n* Ensure we're bubbling the error message up correctly. You shouldn't have to run a custom build with extra trace commands to get it."}}