I have been using Github as an individual for some time. Now I need to create an organization and start a repo in the organization.
So, logged in to Github as myself, I created the new organization. I then created a repo. Viewing the repo I can see that I am a contributor to the repo. The repo is, and needs to be, private.
When I try to clone:
$ git clone https://github.com/my-organization/my-repo.git my-repo-folder
Cloning into 'my-repo-folder'...
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-repo.git/' not found
Locally git is remembering my credentials, so for example, if I have a repository in my personal Github repos, which is private, then
git clone https://github.com/Webern/my-personal-private-repo.git
works without requesting that I re-enter my Github username and password.
What is going on with the organization? How do I clone my newly-formed organizations private repo?
(1) Right click inside the folder you want all of the repos to clone to (2) select "Git Bash Here" - Bash window will open (3) Edit the script with your org name, then copy and paste it into the bash window (maybe make sure line endings are unix based, not sure, I did just to be safe). (4) it should start running.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With