Skip to main content

When attempting to do a git push, are you getting the following response:

fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin main

 

Quick solution, instead run the command

git push origin main

And the response will push what you were attempting to do

Enumerating objects: 34, done.
Counting objects: 100% (34/34), done.
Delta compression using up to 8 threads
Compressing objects: 100% (19/19), done.
Writing objects: 100% (19/19), 5.64 KiB | 2.82 MiB/s, done.
Total 19 (delta 15), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (15/15), completed with 15 local objects.

 

 

Related articles

Andrew Fletcher11 Jul 2022
How to synchronize two remote Git repositories
Currently, I have a situation where I have two repositories.  The first is where I've held the code since the beginning.  The second has come on board recently and is the client repo.  However, rather than shut the original down, I want to keep both running with the same code....
Andrew Fletcher09 May 2022
Creating then adding a key to the remote repository
In this woalk through I am going to use GitHub.  However, the steps are similar to a Bitbucket profile.  Logged in to your GitHub account, click your profile icon, located (at the time of this writing) on the top right corner.  Select Settings Click SSH and GPG...