The "New Pull Request" menu item in Visual Studio 2022 is disabled when the current branch lacks a remote tracking branch, no upstream repository is configured for Git, or the source control provider (GitHub, Azure DevOps) is not authenticated. This state prevents the IDE from determining where to push commits and create the corresponding pull request object on the remote server.
Verify Remote Repository Configuration
The most common cause for this issue is that the local Git repository does not know where its remote counterpart exists. Visual Studio requires a valid
origin remote URL to function correctly with pull request workflows. If you cloned a repository locally but the remote was removed or changed, the integration breaks.
To check your configuration, open the
Solution Explorer, right-click the project or solution, and select
Git >
Remotes. Look for an entry named
origin. If it is missing, you must add it by selecting
Add Remote and pasting the HTTPS or SSH URL from your GitHub or Azure DevOps repository page. Once added, ensure the checkbox next to
origin is selected as the active remote. Without this link, Visual Studio cannot establish the connection necessary to generate a pull request.
Establish Upstream Tracking Branches
Even if the remote URL is correct, the specific branch you are working on might not be linked to a branch on the remote server. Git distinguishes between local branches and remote-tracking branches. A pull request can only be created if the local branch has an associated upstream branch on the remote.
You can verify this relationship by opening the
Git Changes window. If your branch name appears without any remote reference, you need to set the upstream. Right-click the branch in the
Branches list and choose
Publish Branch. Alternatively, use the command line within Visual Studio’s terminal:
git push --set-upstream origin <branch-name>
This command pushes the current branch to the remote and sets the upstream tracking information. Once the upstream is established, the "New Pull Request" button becomes active because Visual Studio knows exactly which remote branch will receive the changes.
Check Authentication Status
Visual Studio 2022 relies on integrated authentication services to communicate with cloud-based version control systems. If your credentials have expired or the session has timed out, the UI elements related to remote operations will disable themselves to prevent failed network requests.
Navigate to
Tools >
Options >
Accounts. Ensure that your GitHub or Microsoft account is listed and shows a green checkmark indicating successful authentication. If you see an error or stale status, sign out and sign back in. For GitHub specifically, ensure you are using the personal access token method if password authentication is deprecated in your organization's policy. Re-authentication forces Visual Studio to refresh the API tokens required to create pull requests.
Validate Source Control Provider Selection
Sometimes the issue stems from the wrong provider being active. Visual Studio supports multiple providers, including GitHub, Azure Repos, and Bitbucket. If the project was initialized with one provider but you are trying to interact with another, the menu items may remain greyed out.
Go to
Tools >
Options >
Source Control >
Plugin Selection. Verify that the correct plugin is selected for your repository type. If you recently migrated a repository or switched organizations, you may need to re-initialize the Git folder. Be aware that changing the provider often requires cleaning up the
.git/config file to remove old remote references before adding new ones.
Related Resources
For more detailed guidance on integrating external tools with Visual Studio, see
Running 'gh ...' Local Git Lot Changes. Additionally, if you encounter authentication loops during these processes, reviewing
Troubleshooting OAuth2.0 Access Token Response may provide insights into token handling mechanisms.
Clear Visual Studio Cache
In rare cases, corrupted cache files within Visual Studio can cause UI states to persist incorrectly even after fixing configuration issues. The Git integration layer caches metadata about branches and remotes. If this cache becomes desynchronized with the actual Git state, the UI may fail to update the enabled state of buttons.
To resolve this, close Visual Studio completely. Navigate to the user data directory, typically located at
%LOCALAPPDATA%\Microsoft\VisualStudio\17.0\. Delete the
ComponentModelCache folder. Restart Visual Studio and reopen your solution. The IDE will rebuild the cache from scratch, often restoring functionality to disabled menus.
Frequently Asked Questions
Why is the PR button greyed out if I have uncommitted changes?
Uncommitted changes do not disable the pull request menu; Visual Studio allows creating PRs from work-in-progress states. The button is disabled specifically due to missing remote configuration, lack of upstream tracking, or authentication failures. You can still commit your changes first, but the root cause remains environmental rather than state-based.
Can I create a pull request without publishing the branch first?
No, you must publish the branch to the remote repository before Visual Studio can create a pull request. Publishing creates the remote branch and sets the upstream tracking reference. Until the branch exists on the server, there is no target for the pull request, so the option remains inactive.
What if I am using Azure DevOps instead of GitHub?
The troubleshooting steps are identical regardless of the provider. Ensure you are signed into your Microsoft Account with appropriate permissions in Azure DevOps. Check the
Source Control Plugin Selection to ensure Azure Repos is active. The logic for upstream tracking and remote URLs applies equally to both platforms.
Does deleting the .git folder fix this issue?
Deleting the
.git folder destroys your local history and should be avoided unless you intend to start fresh. Instead, modify the
.git/config file manually to remove incorrect remote URLs. This preserves your commit history while correcting the configuration that disables the UI features.
How do I know if my Git credentials are expired?
Try running a simple Git command like
git fetch in the terminal. If it prompts for a password or returns a 401 Unauthorized error, your credentials are invalid. In Visual Studio, go to
Tools >
Options >
Accounts to refresh your login session immediately.