git error: failed to push some refs to remote #49593
-
Select Topic AreaQuestion BodyI can't push now, though I could do it yesterday. When I use git push origin master, I get an error: $ git push origin master |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 16 replies
-
Hello @SuperJUNOed .
|
Beta Was this translation helpful? Give feedback.
-
And you can rename existing repository default branch from master to main. (The following assumes github.com itself is not down, as eri0o points out in the comments: see www.githubstatus.com to be sure) If the GitHub repo has seen new commits pushed to it, while you were working locally, I would advise using:
The full syntax is:
With Git 2.6+ (Sept. 2015), after having done (once)
A simple git pull would be enough. That way, you would replay (the --rebase part) your local commits on top of the newly updated origin/main (or origin/yourBranch: git pull origin yourBranch). See a more complete example in the chapter 6 Pull with rebase of the Git Pocket Book. I would recommend a:
That would establish a tracking relationship between your local main branch and its upstream branch.
Again, with Git 2.37+ and its global option push.autoSetupRemote, a simple git push even for the first one would do the same (I.e: establishing a tracking relationship between your local main branch and its upstream branch origin/main). Since the OP already reset and redone its commit on top of origin/main:
There is no need to pull --rebase. Note: git reset --mixed origin/main can also be written git reset origin/main, since the --mixed option is the default one when using git reset. |
Beta Was this translation helpful? Give feedback.
-
It seems like right now there might be some issues on Github that cause these issues. I've seen errors regarding pushing, but then the commit actually did make it in the repository. The actions also seem to be broken - I see no status or information about them. https://www.githubstatus.com/ shows some issues; |
Beta Was this translation helpful? Give feedback.
-
git pull --rebase origin main git push -u origin main |
Beta Was this translation helpful? Give feedback.
-
I got the same error, The reason behind it was, I exposed one of my API keys in a working file, I moved it to env, and it worked for me. |
Beta Was this translation helpful? Give feedback.
And you can rename existing repository default branch from master to main.
The rest of this 2014 answer has been updated to use "main")
(The following assumes github.com itself is not down, as eri0o points out in the comments: see www.githubstatus.com to be sure)
If the GitHub repo has seen new commits pushed to it, while you were working locally, I would advise using:
The full syntax is:
With Git 2.6+ (Sept. 2015), after having done (once)
A simple git pull would be enough.
(Note: with Git 2.27 Q2 2020, a merge.autostash is als…