Argo CD Git repository branch not found

The specified branch in the Git repository does not exist.

Understanding Argo CD

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. It automates the deployment of the desired application states in the specified Git repositories to the Kubernetes clusters. By continuously monitoring the Git repositories, Argo CD ensures that the live state of applications matches the desired state defined in Git.

Identifying the Symptom

When using Argo CD, you might encounter an error indicating that a Git repository branch is not found. This typically manifests as a synchronization failure in the Argo CD dashboard, where the application status shows an error related to the branch.

Common Error Message

The error message might look like this: "Error: Unable to find branch 'feature-branch' in repository 'https://github.com/example/repo.git'".

Exploring the Issue

The error occurs when the specified branch in the application configuration does not exist in the Git repository. This can happen due to a typo in the branch name, the branch being deleted, or the branch never having been created.

Root Cause Analysis

To diagnose the issue, verify the branch name specified in the Argo CD application configuration. Check the Git repository to ensure the branch exists. If the branch was recently deleted or renamed, update the configuration accordingly.

Steps to Fix the Issue

Follow these steps to resolve the issue:

Step 1: Verify the Branch Name

Log into your Git repository and check if the branch exists. You can use the following Git command to list all branches:

git branch -a

If the branch is not listed, it does not exist in the repository.

Step 2: Update the Application Configuration

If the branch name was incorrect, update the Argo CD application configuration with the correct branch name. You can do this via the Argo CD CLI or the web UI. For example, using the CLI:

argocd app set my-app --revision new-branch-name

Step 3: Resynchronize the Application

After updating the branch name, resynchronize the application to apply the changes:

argocd app sync my-app

Additional Resources

For more information on managing applications in Argo CD, refer to the Argo CD User Guide. If you need to troubleshoot further, the Argo CD Troubleshooting Guide can be helpful.

By following these steps, you should be able to resolve the "Git repository branch not found" error and ensure your applications are correctly synchronized with the desired state in your Git repository.

Never debug

Argo CD

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Book Demo
Automate Debugging for
Argo CD
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid