Conan upload fails with a git error

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 --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

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.

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

See: 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.

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