GitHub Problems

A while ago I went through the process of changing my primary branch from "master" to "main". This was all good UNTIL I went to push some changes to my GitHub site which was still a "master" branch. Then everything went sideways! I tried all the hints they presented such as renaming the master branch on GitHub site but still am getting errors such as: origin is missing check that you have permission ... Change the upstream settings (I did this but nothing changed) Is there a fix for this (5 minutes or less) or would it just be easier & faster to simply delete the whole account and start over? Thanks!
5 Replies
Joao
Joao•2y ago
Open a terminal and run git remote. If you don't see anything or get an error, you probably just need to adjust that bit. Run git remote add origin <url of your repo> and push once with git push -u origin main. You could also check for this using git config -l
TedS
TedSOP•2y ago
Thanks for the reply. When I run git config -l I do get my info which includes init.defaultbranch=main. When I ran git remote add origin user.github.io nothing is displayed. When I ran git push -u origin main the result was this: fatal: 'user.github.io' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Could it be time to just nuke the account & start over, or is there a simple way forward? Thanks.
Joao
Joao•2y ago
You could nuke your account... but then what happens when you get this error next time? Not a very sustainable practice in my opinion 🙂 Try to take this as an opportunity to learn one of the most common tools used in the industry, instead. With that said, I wonder if you are using the "https" url or the "ssh" one? As I recalll, GitHub no longer allows pushing changes using https so make sure you are using the ssh option. If you already are using ssh and still get this error, I have another question for you: what OS are you using? And I'm asking about this because if your answer is Windows, then I don't know how to fix it. Although from the looks of it, it's well documented how you can test if your SSH is correct and how to recover it from the documentation itself: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection If everything is correct check out this page on how to add your ssh key to the ssh agent. It looks like it uses the same commands for all three platforms. Sometimes, you may need to do this. https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=windows#adding-your-ssh-key-to-the-ssh-agent And finally, I would check this page which talks about changing the default branch. In case none of the other doc pages help. https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch
TedS
TedSOP•2y ago
I'll check all this out when I get home! I've never used ssh, but hadn't done anything with this page for over 6 months - did GitHub stop allowing https pushes since then? Well I read the above articles, read numerous Stackoverflow articles, generated an SSH key and managed to add it - and still have bizarre errors. I think this is all because I pushed a totally different temporary page to GitHub 8 months ago and THEN did the politically correct adventure of changing my primary branch from master to main. I tried!!! I appreciate the help but this is just a hobby for me, time for a new account...
Joao
Joao•2y ago
Fair enough, at least you tried so that's already some experience. I don't remember when GitHub made the decision to allow only SSH, but it was around that time possibly. Politically correct changes for the sake of change are mostly useless, in my opinion. I still have many repos from before that using master as the default branch and have no intention of changing them over to something else...
Want results from more Discord servers?
Add your server