fatal: 'origin' does not appear to be a git repository
try this
git remote add origin <https://github.com/"username"/"repository".git>
then try to again
git push -u origin master
When you run git clone <repo_url>
to clone a repository, the default remote origin
is created automatically. If the repository is created by git init
, there is no default remote, no origin
. You need to set it up by yourself.
git remote add origin <repo_url>
repo_url
is the path to an existing remote repository which you want to exchange data with . If it's in the local disk, it could be file:///home/me/foo.git
or /home/me/foo.git
. If it's hosted in Github, it could be https://github.com/me/foo.git
or ssh://[email protected]/me/foo.git
.
As to the 2nd error about "fetch first". You need to run git pull origin <branch>
or git pull -r origin <branch>
before a next push.
I had this same error message while trying to do a PR. On a critical look, I realized I was carrying out the Git workflow on a wrong directory.
In my case, I simply went back a step to the right dir using **cd..** and then proceeded with no more error.
git remote add origin <url>
then
git push -u origin master