Skip to main content

git fatal: The current branch {} has no upstream branch

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

Changing git push from passphrase

Changing git push from passphrase?  There are several ways to tackle this step.  I'm going to focus one of these steps.

From your web directory root, look for your .git directory.  Then open the .git...

cd .git

Next using your shell prompt (iTerm2), view the contents of the config file

vim config

Presently the config file looks like the following

Subscribe to git