Ultimately I believe the problem had something to do with the caching of credentials in my Mac's Keychain. The complete list of steps taken to fix the problem is below, but I believe the crucial step was to delete all Github credentials using Mac OS's Keychain Access utility.
Adding the username and password to the https URL does work, but seems like a bad idea for permanent use.
MyMac:~ mjb$ git clone https://MyGithubUsername:[email protected]/my-organization/my-repo.git
MyMac:~ mjb$ cd my-repo
MyMac:my-repo mjb$ git remote set-url origin https://github.com/my-organization/my-repo.git
After changing the URL back so that it does not contain my username and password, I still could not connect to the remote.
MyMac:my-repo mjb$ git push origin --all
remote: Repository not found.
Now I did a bunch of flailing with git config, which I suppose was unnecessary.
MyMac:my-repo mjb$ git config --global user.name MyGithubUsername
MyMac:my-repo mjb$ git --version
git version 2.15.0
MyMac:my-repo mjb$ git config --global credential.helper manager
MyMac:my-repo mjb$ git push origin --all
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-repo.git/' not found
MyMac:my-repo mjb$ git config --global --unset credential.helper
MyMac:my-repo mjb$ git push origin --all
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-repo.git/' not found
Now I went on my Mac to Utilities -> Keychain Access
I deleted all credentials relating to Github
What is strange about this is that they were correct, and when I entered my username and password again I was entering the same username and password.
MyMac:my-repo mjb$ git push origin --all
Username for 'https://github.com': MyGithubUsername
Password for 'https://[email protected]': MyGithubPassword
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 651 bytes | 651.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Success.
origin
in your fresh clone and do agit fetch
? I've never dealt with private repos over https, so just trying to poke at things right now. – Moralesgit remote set-url origin https://github.com/my-organization/my-repo.git
thengit fetch
and gotfatal: repository 'https://github.com/my-organization/my-repo.git/' not found
– Joanniejoao