Git lfs push error: Repository or object not found
Asked by vdg:

Hi

I am facing a problem pushing commits to origin that reference files stored as LFS. This is a GIT trace:

$ GIT_TRACE=1 git push  
15:23:40.889667 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin  
15:23:40.894663 git.c:459 trace: built-in: git push  
15:23:40.895664 run-command.c:654 trace: run_command: GIT_DIR=.git git remote-https origin <https://bitbucket.org/XXX/YYYY/src/main/>  
15:23:40.912664 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core  
15:23:40.915666 git.c:748 trace: exec: git-remote-https origin <https://bitbucket.org/XXX/YYYY/src/main/>  
15:23:40.915666 run-command.c:654 trace: run_command: git-remote-https origin <https://bitbucket.org/XXX/YYYY/src/main/>  
15:23:40.933668 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core  
15:23:41.444851 run-command.c:654 trace: run_command: 'git credential-manager-core get'  
15:23:41.559882 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core  
15:23:41.561878 git.c:748 trace: exec: git-credential-manager-core get  
15:23:41.561878 run-command.c:654 trace: run_command: git-credential-manager-core get  
15:23:43.752550 run-command.c:654 trace: run_command: 'git credential-manager-core store'  
15:23:43.828515 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core  
15:23:43.831722 git.c:748 trace: exec: git-credential-manager-core store  
15:23:43.831722 run-command.c:654 trace: run_command: git-credential-manager-core store  
15:23:44.428946 run-command.c:654 trace: run_command: .git/hooks/pre-push origin <https://bitbucket.org/XXX/YYYY/src/main/>  
15:23:44.511947 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core  
15:23:44.515946 git.c:748 trace: exec: git-lfs pre-push origin <https://bitbucket.org/XXX/YYYY/src/main/>  
15:23:44.515946 run-command.c:654 trace: run_command: git-lfs pre-push origin <https://bitbucket.org/XXX/YYYY/src/main/>  
15:23:44.540715 trace git-lfs: exec: git 'version'  
15:23:44.593788 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote' '-v'  
15:23:44.628214 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote'  
15:23:44.661516 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'  
15:23:44.695441 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-dir' '--show-toplevel'  
15:23:44.731629 trace git-lfs: exec: uname  
15:23:44.816914 trace git-lfs: exec: cygpath '-w' '.git'  
15:23:44.865606 trace git-lfs: exec: cygpath '-w' 'D:/data/Staubli/SRS/_Customers/Zoetis/33842 Zoetis-SAS-Automated Feeding'  
15:23:44.907952 trace git-lfs: exec: git 'config' '--includes' '-l'  
15:23:44.939972 trace git-lfs: exec: git 'rev-parse' '--is-bare-repository'  
15:23:44.970077 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' ':.lfsconfig'  
15:23:45.004845 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' 'HEAD:.lfsconfig'  
15:23:45.052954 trace git-lfs: exec: cygpath '-w' 'C:/Program Files/Git/mingw64/bin/git-askpass.exe'  
15:23:45.096084 trace git-lfs: exec: cygpath '-w' 'C:/Program Files/Git/mingw64/bin/git-askpass.exe'  
15:23:45.141164 trace git-lfs: pre-push: refs/heads/development 5fb4b0ee83cdd1f799ea8c8582b54002108ab7aa refs/heads/development a87a1f271d068ea0aa05b5dbd38c8011aed3cd56  
15:23:45.143292 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'show-ref'  
15:23:45.175597 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'ls-remote' '--heads' '--tags' '-q' 'origin'  
15:23:48.800537 trace git-lfs: tq: running as batched queue, batch size of 100  
15:23:48.803160 trace git-lfs: run_command: git rev-list --objects --ignore-missing --stdin --  
15:23:48.803160 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-list' '--objects' '--ignore-missing' '--stdin' '--'  
15:23:48.809366 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'cat-file' '--batch-check'  
15:23:48.815018 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-common-dir'  
15:23:48.866517 trace git-lfs: exec: cygpath '-w' '.git'  
15:23:48.929093 trace git-lfs: exec: cygpath '-w' '.git'  
15:23:49.113570 trace git-lfs: tq: sending batch of size 2  
15:23:49.113570 trace git-lfs: api: batch 2 files  
15:23:49.124585 trace git-lfs: exec: cygpath '-w' 'C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt'  
15:23:49.174527 trace git-lfs: HTTP: POST <https://bitbucket.org/XXX/YYYY/src/main.git/info/lfs/objects/batch>  
15:23:49.677018 trace git-lfs: http: decompressed gzipped response  
15:23:49.677772 trace git-lfs: HTTP: 404  
15:23:49.678082 trace git-lfs: api error: Repository or object not found: <https://bitbucket.org/XXX/YYYY/src/main.git/info/lfs/objects/batch>  
Check that it exists and that you have proper access to it  
Uploading LFS objects: 0% (0/2), 0 B \| 0 B/s, done.  
batch response: Repository or object not found: <https://bitbucket.org/XXX/YYYY/src/main.git/info/lfs/objects/batch>  
Check that it exists and that you have proper access to it  
error: failed to push some refs to '<https://bitbucket.org/XXX/YYYY/src/main/>'

The URL is correct and pulling from remote works, too.

Any hints or ideas? Thanks in advance!

Volker


Answers:
author: Theodora Boudale
body: Hi [@vdg](/t5/user/viewprofilepage/user-id/2131439),

Based on the output you provided, the URL for the remote repo doesn't seem to be correct, which may be related to the error you get.

You can use <https://bitbucket.org/XXX/YYYY/src/main/> to access the repo from browser, but this is not valid as the URL of the remote repo of a clone.

You can run the following command in the directory of the clone

```
git remote -v
```

If the output looks like this:

```
origin https://bitbucket.org/XXX/YYYY/src/main/ (fetch)
origin https://bitbucket.org/XXX/YYYY/src/main/ (push)
```

You can change that URL to either

```
https://bitbucket.org/XXX/YYYY.git
```

or, if you use username+password authentication to the following:

```
https://username@bitbucket.org/XXX/YYYY.git
```

where **username** is your Bitbucket username, which you can find here <https://bitbucket.org/account/settings/>

The command to change the remote URL of your clone is the following:

```
git remote set-url origin https://bitbucket.org/XXX/YYYY.git
```

or as follows, if you want to use the URL with the username

```
git remote set-url origin https://username@bitbucket.org/XXX/YYYY.git
```

Kind regards,  
Theodora


author: Erez Maadani
body: Hi [@vdg](/t5/user/viewprofilepage/user-id/2131439)

I would recommend to:

1. Check missing write permission.
2. Replace HTTPS with SSH.

comments: author: vdg
body: Hi Erez,

thanks for the suggestions. I checked permissions and couldn't find anything wrong. I am admin on the repo with write/config permissions. Your 2nd suggestion I am not quiet sure which url shall be changed from HTTPS to SSL. I tried the origin url, but this returns:

```

$ GIT_TRACE=1 git push
20:51:07.009710 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
20:51:07.013613 git.c:459 trace: built-in: git push
20:51:07.015623 run-command.c:654 trace: run_command: GIT_DIR=.git git remote-ssl origin ssl://bitbucket.org/XXX/YYYY/src/main/
20:51:07.030567 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:51:07.034566 git.c:748 trace: exec: git-remote-ssl origin ssl://bitbucket.org/XXX/YYYY/src/main/
20:51:07.034566 run-command.c:654 trace: run_command: git-remote-ssl origin ssl://bitbucket.org/XXX/YYYY/src/main/
git: 'remote-ssl' is not a git command. See 'git --help'.


```

For now I have deactivated LFS and will look at this at a later point again.


author: Erez Maadani
body: Hi [@vdg](/t5/user/viewprofilepage/user-id/2131439)

I had a typo in my previous answer, instead of SSL, it should have been SSH.

To be more exact, I meant to replace the HTTPS connection with an SSH connection. You can read more about it here: <https://support.atlassian.com/bitbucket-cloud/docs/configure-ssh-and-two-step-verification/>


Tags: bitbucket-cloud

cloud