1

System:

MacOS Catalina 10.15.5 SourceTree v4.0.1

Issue:

I have a local repository that I've cloned from Github. That repository also exists in another remote (it's actually git repo for an Azure Function, so not one of the other usual suspects e.g. Bitbucket), and I'm simply trying to set up that remote so I can fetch/push/etc to it.

I've done this on a previous machine, and I'm getting re-set up for development on a new MacBook, so it's something that I've done before, but I just made a simple copy/paste mistake that I can't seem to undo.

In SourceTree, I went to the menu to add a remote and only input the remote URL:

enter image description here

After I okayed that, I went to the list of remotes, right click the new addition to the list, and attempted a fetch. This prompted me for a username and then a password. I incorrectly copy/pasted one of the two values, but that seems to be stuck now with no way of simply deleting it.

Now, when I try to fetch (or do anything) with that particular remote, I continually get a 403 Forbidden response.

git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch remote-name
fatal: unable to access 'https://actual-remote-url/git.git/: The requested URL returned error: 403

I've searched most of the other SO posts here about removing the individual entries from Keychain Access as well as removing the files from Application Support.

I had SourceTree open when I removed the keys directly from the Keychain, so that may have had an impact, but after removing them and trying to fetch from the remote again, I simply got the same 403 error as before (rather than it asking for the credentials).

The same happened after clearing the Application Support folder for SourceTree. It re-asked me my credentials for the Github remote, but it didn't ask me anything for the new remote. When I tried to fetch, I got the same 403 error as before.

Switching between the Embedded Git and System Git seems to have no effect at all.

I've gone around the horn and back trying to solve this (an absolutely ridiculous 3 hours at this point TO ADD A REMOTE) and have also tried:

  • Trashing and Reinstalling Sourcetree
  • Playing with the security command line tool (the CLI for Keychain) to see if I could find a hidden reference anywhere to the remote that was hanging in limbo
  • Fiddling with credential-helper stuff (mostly throwing stuff at the wall and nothing sticking)
  • Restarting the machine

But, absolutely nothing I try yields the username/password prompt again and I always receive the 403.

My best guess is that this is somehow related to the -c credential.helper=sourcetree bit in the git command that Sourcetree initially issued. Is there a separate credential store that is keeping my old creds around?

A bit of testing seems to indicate that this is the case. I have yet another remote where the same repository is hosted, and when I set that up (no flubbing on the username/password), and then remove the credentials that are saved to Keychain, a subsequent fetch doesn't ask me for my credentials. But, where in the *?!$ are they?? (and how do I clear them??)

MandM
  • 3,043
  • 4
  • 29
  • 52

1 Answers1

0

My best guess is that this is somehow related to the -c credential.helper=sourcetree bit in the git command that Sourcetree initially issued. Is there a separate credential store that is keeping my old creds around?

Apparently so: see this 2014 thread, revised in 2020:

Funny how I'm still having this problem in 2020, I blame this on Apple though as I've experienced this same problem in one way or another with all of their products.
They demand you link up with other services, or they punish you with alerts and popups non-stop till you are shaking with rage.
None of the above solutions worked for me but I found one that did:

Remove the Atlassian/BitBucket association from SourceTree.

Preferences>Accounts>RemoveAccount
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Thanks for the answer, but unfortunately the "Accounts" page only lists accounts for services that Sourcetree supports (Bitbucket, Github, GitLab, and Azure DevOps). The service I'm using isn't one of those, and is just a "Generic" service that uses standard username/password authorization for Git over HTTPs. That's all to say that, I actually don't have any accounts listed in Preferences->Accounts, so there's no account to remove. – MandM Jun 24 '20 at 15:47