I have been going at the endlessly all semester. I was able to add project from my prior year in school but have been unable to push and new projects to my repository.
I have tried deleting my key credentials via my key access chain. I have created a new GitHub account and tried using that one. I have deleted repositories started from scratch over and over.
I have read question on question and tried following multiple different answers on here. What I wouldn't give to understand what is going on and why nothing seems to allow me to push a project anymore.
The most current attempt was going back to my original GitHub account. I created a brand new repository. I created a new folder and copied my simple python project into it and saved.
error: remote origin already exists.
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote rm origin
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote rm upstream
error: No such remote: 'upstream'
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/stephanieBrandon/GuessARandomNumberGame.git'
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % ls -a
. .. guess_a_random_number.py
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /Users/stephaniebrandon/Documents/GitHubPortfolio/Python/GuessARandomNumberGame/pythonGame/.git/
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/stephanieBrandon/GuessARandomNumberGame.git'
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % ls -a
. .. .git guess_a_random_number.py
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git status
On branch master
I am hoping there is just some simple thing I am missing, if someone could explain and help me out it would be much appreciated.
CodePudding user response:
Stephanie, your local branch name is "master", not "main" as you can see from the "git status" output.
If you try "git push origin master", it should work.
CodePudding user response:
You dont have branch main, you have branch master.