argo-cd: The 'repo add' command incorrectly requires upsert flag

Describe the bug

The ‘repo add’ command incorrectly requires upsert flag even if repo add command does not introduce any changes if repo configuration

To Reproduce

  1. Manually add repository https://github.com/argoproj/argocd-example-apps in argocd-cm config map.
  2. Run argocd repo add https://github.com/argoproj/argocd-example-apps
  3. Command fails with error existing repository spec is different; use upsert flag to force update

Expected behavior

The upsert should not be required in this case

Screenshots

If applicable, add screenshots to help explain your problem.

Version

v1.3.6

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

@siddana123 can you please check if in the secret associated with your repo the following label is defined?

labels:
    argocd.argoproj.io/secret-type: repository

I had the same problem when upgraded from v2.0 to v2.1.4. I had to manually removed the repo-**** secret where the SSH key was already defined.

also experienced the same issue on v2.1.2

Experienced the Same Problem with Version 2.1.2.

@pasha-codefresh thanks Side note : maybe the issue is only if argocd has been updated to a new version, not sure about that but I had the issue only on clusters where I did an upgrade, not fresh install

Hi 😃 Same problem with 2.1.1 here are the details :

$ argocd  version  --short                                                                          
argocd: v2.1.1+aab9542
argocd-server: v2.1.1+aab9542

$ argocd repocreds list
URL PATTERN                     USERNAME  SSH_CREDS  TLS_CREDS
git@$GIT_URL:  -         false      false

# Same repo, same key
$ argocd repocreds add git@$GIT_URL: --ssh-private-key-path ~/.ssh/argocd.pem
FATA[0002] rpc error: code = InvalidArgument desc = existing repository credentials spec is different; use upsert flag to force update

$ argocd repocreds rm git@$GIT_URL:
Repository credentials for 'git@code.tooling.prod.cdsf.io:' removed

$argocd repocreds add git@$GIT_URL: --ssh-private-key-path ~/.ssh/argocd.pem
Repository credentials for 'git@$GIT_URL:' added

And then any addtionnal argcd repocreds add is ok

we had luck reverting to v2.0.2

@neelk-s1 2.0.4 is good as well. I am thinking the moment you go to the next minor version the trouble begins.

@alexmt Face this issue in 2.1.0 again. Unable to add the repo. Unable to connect HTTPS repository: existing repository spec is different; use upsert flag to force update