# Conan upload fails with a git error

**URL:** <https://community.sonatype.com/t/conan-upload-fails-with-a-git-error/15916>\
**Category:** Sonatype Nexus Repository\
**Tags:** nexus-repository\
**Created:** [December 22, 2025, 5:40pm UTC](https://community.sonatype.com/t/conan-upload-fails-with-a-git-error/15916 "2025-12-22T17:40:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Michel](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@Frank\_Michel](https://community.sonatype.com/u/Frank_Michel)\
**Post date:** [December 22, 2025, 5:40pm UTC](https://community.sonatype.com/t/conan-upload-fails-with-a-git-error/15916/1 "2025-12-22T17:40:59Z")

</div>

Hello,

I am testing a new build solution using “conan build” and “Sonatype Nexus Repository, Community Edition version 3.85” on Windows 11.

I followed the steps from Nexus Help using the following commands:

1. Create a conan-hosted repository in Nexus named “conan-hosted” with default settings

2. Declare the remote conan-hosted repository:  
**dev@win11\>** conan remote add conan-hosted [http://localhost:8081/repository/conan-hosted](http://localhost:8081/repository/conan-hosted) --insecure

3. Add authentification for remote:  
**dev@win11\>** conan remote auth …

4. Check cots exists in conan cache:  
**dev@win11\>** conan list boost  
… existing …

5. Try to upload to remote repository:  
**dev@win11\>** conan upload boost/1.86.0 -r conan-hosted

=\> fatal: not a git repository (or any of the parent directories: .git  
=\> ERR: retrieving root repository

Please help with interpreting this error,  
Thanks

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [December 22, 2025, 6:02pm UTC](https://community.sonatype.com/t/conan-upload-fails-with-a-git-error/15916/2 "2025-12-22T18:02:45Z")

</div>

This error isn’t from Nexus its from Conan. I’d hazard from the error it expects the command to be run on a project managed by git but you may have more success asking this question on a Conan support forum.

---

<div class="post-metadata">

**Author:** ![Frank\_Michel](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@Frank\_Michel](https://community.sonatype.com/u/Frank_Michel)\
**Post date:** [December 29, 2025, 2:16pm UTC](https://community.sonatype.com/t/conan-upload-fails-with-a-git-error/15916/3 "2025-12-29T14:16:18Z")

</div>

Finally, I managed to get it working : it is a known bug in Nexus Repository.

See: [https://github.com/conan-io/conan/issues/16770](https://github.com/conan-io/conan/issues/16770)

The workaround is to enable the Conan bearer token in the “settings / security / realms” section.  
After this, it works properly.

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [January 5, 2026, 8:25pm UTC](https://community.sonatype.com/t/conan-upload-fails-with-a-git-error/15916/4 "2026-01-05T20:25:45Z")

</div>

Its great that you’ve found a solution but the linked ticket doesn’t appear to match the errors described in the original post.
