conan-io / conan-io/docs

Conan 2.0 Git Authentication and Credentials

Open
#2,918 14 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
stage: triaging
Dominant language
C++
Stars
125
Forks
382
Avg merge
22h 39m
Merged PRs (30d)
21

Description

### What is your question?

Hi,

Our company manages our projects via GitLab. They are internal and hence private, requiring credentials for authentication.

We are following the Conan 2.0 migration guide [here](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#the-scm-attribute). This document does not talk about credentials and how to authenticate. Conan Git 2.0 does not appear to have any built-in mechanisms for handling authentication.

The only related issue/question I can find is [here](https://github.com/conan-io/conan/issues/10777). This discussion mentions that it is bad practice to merge credentials directly into the URL. I am also not sure this is possible with GitLab. If I am interpreting the discussion correctly, the only solution is to write a custom wrapper around the Conan tools Git object? To create a custom Git credentials manager?

Before now we have used the Conan `exports` attributes to handle copying source code to the local Conan cache. But this results in uploading the source with the package so the recipe can be stand-alone. We do not want our source code uploaded hence the migration to Conan SCM/Git.

The error we are getting is as follows:

```
returned non-zero exit status 128.
Cloning into '.'...
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://xxx.xxx.xxx.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://xxx/xxx/xxx/xxx.git/'
```

Any help would be greatful,

Thanks

### Have you read the CONTRIBUTING guide?

- [X] I've read the CONTRIBUTING guide

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.