Changing the Default Browser for Source Tree OAuth Authentication
If you're using a Windows PC with Chrome as the default browser and have Bitbucket credentials saved in your Edge profile, you may encounter an issue where Source Tree desktop app always loads Chrome to perform OAuth authentication, even when Edge is your preferred browser.
Understanding the Issue
Source Tree is a popular Git client for Windows and Mac that allows developers to interact with their repositories through a graphical user interface. When you need to authenticate with a remote service like Bitbucket, Source Tree launches your default browser to complete the OAuth authentication flow.
However, Source Tree always launches Chrome for this process, even if you have set Edge as your default browser in Windows. This issue can be frustrating, especially if you prefer to use Edge for its features like improved privacy and better integration with other Microsoft services.
Resolving the Issue
To resolve this issue, you can follow these steps:
Set Chrome as your default browser in Windows.
Launch Source Tree and start the OAuth authentication flow in Bitbucket.
Once the authentication is complete, switch back to Edge as your default browser.
Clear your Bitbucket credentials from the Edge profile.
Set Edge as your default browser in Windows.
Launch Source Tree again and attempt to authenticate with Bitbucket. Source Tree should now launch Edge instead of Chrome for the OAuth authentication flow.
Programmatic Solution
If you prefer a more automated solution, you can write a simple script to change the default browser in Windows before launching Source Tree. Here's an example using PowerShell:
# Set Chrome as the default browser
Set-ItemProperty -Path 'HKCU:\Software\Classes\http\shell\open\command' -Value ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -- %1"
# Launch Source Tree
Start-Process 'C:\Program Files\Atlassian\SourceTree\SourceTree.exe'
# Wait for Source Tree to finish launching
Start-Sleep -Seconds 5
# Set Edge as the default browser
Set-ItemProperty -Path 'HKCU:\Software\Classes\http\shell\open\command' -Value ""C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" -- %1"
This script temporarily sets Chrome as the default browser, launches Source Tree, waits for it to finish launching, and then sets Edge as the default browser again. You can schedule this script to run whenever you log in or before you launch Source Tree manually.
Windows PCs with Chrome as the default browser and Bitbucket credentials saved in the Edge profile may encounter issues with Source Tree launching Chrome for OAuth authentication.
To resolve this issue, you can set Chrome as the default browser, launch Source Tree, complete the authentication flow in Bitbucket, clear your Bitbucket credentials from the Edge profile, and then set Edge as the default browser again.
Alternatively, you can write a PowerShell script to automate this process.