---
id: SAIFTRBL0012
moved_from:
  - guides/troubleshooting/saif-publish-remote-origin-url-mismatch.md
title: "saif publish fails: Remote 'origin' already exists with different URL"
description: saif publish tries to add a git remote without the org user prefix, but an existing origin remote still has the old user@ prefixed URL, so the add fails.
tags:
  - troubleshooting
  - cli
---

# saif publish fails: Remote 'origin' already exists with different URL

**One-sentence summary:** `saif publish` tries to add an `origin` remote without a user prefix, but the repository's existing `origin` remote still has the old `user@` prefixed Azure DevOps URL, so the add fails; update the git remote URL manually to remove the user prefix.

---

## 🚨 Symptom

`saif publish` fails while pushing to the remote, with output similar to:

```text
i Publishing application from C:\Users\<user>\dev\<repo-name>
i Repository '<repo-name>' already exists, reusing it
i Pushing to remote...
i git remote add origin https://dev.azure.com/<org>/<project>/_git/<repo-name>
Error: Remote 'origin' already exists with URL 'https://<org>@dev.azure.com/<org>/<project>/_git/<repo-name>'. Cannot add with different URL
'https://dev.azure.com/<org>/<project>/_git/<repo-name>'.
Command completed in 4783ms
```

---

## 📌 Applies to

| Aspect | Value |
| ------ | ----- |
| **Component** | `saif` CLI, `saif publish` |
| **Forge versions** | `saif` CLI 3.8.4 and earlier (fixed in 3.9.0, not yet released) |
| **Related versions** | Check the [version compatibility matrix](../reference/version-compatibility.md) |

---

## 🧠 Cause

The local repository's `origin` remote was set up earlier with an Azure DevOps URL that includes the organization name as a user prefix (`https://<org>@dev.azure.com/...`). `saif publish` tries to add `origin` again using the same URL without that user prefix (`https://dev.azure.com/...`). Git treats these as different remote URLs and refuses to overwrite the existing one, so the command fails. This is fixed in `saif` CLI 3.9.0, which has not shipped yet as of this writing.

---

## ✅ Fix

Until 3.9.0 ships, update the existing `origin` remote to drop the `user@` prefix so it matches what `saif publish` expects:

1. Check the current remote URL:

    ```powershell
    git remote -v
    ```

2. Update it to remove the `<org>@` prefix:

    ```powershell
    git remote set-url origin https://dev.azure.com/<org>/<project>/_git/<repo-name>
    ```

3. Re-run `saif publish`.

---

## 🔬 Verify

```text
git remote -v
```

shows `origin` without the `user@` prefix, and `saif publish` completes without the "Remote 'origin' already exists with different URL" error.

---

## 📚 Related

- [saif publish does not create Azure DevOps pipelines for a new or renamed repo](saif-publish-pipelines-not-created.md)
