Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal- 'origin' does not appear to be a git repository

Tags:

git

github

I created a remote repo then create a local one locally:

git init

then added the files i need using git add then git commit -m "something"

finally git push origin master

I got this error fatal:

'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

should i like the remote and local in some command or something? and if so is it ok if i already added and commited or should i start over locally?

EDIT:

Apparently i should add git remote add origin ssh://[email protected]:1234/myRepo.git but what should i replace that ssh with as in where can i find my version of what i should add.

Got this error :

! [rejected]        master -> master (fetch first)
error: failed to push some refs to 
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
like image 304
Kelly Avatar asked Jul 11 '18 06:07

Kelly


People also ask

How do you fix fatal origin does not appear to be a git repository?

Conclusion. The “fatal: 'origin' does not appear to be a git repository” error occurs when you try to push code to a remote Git repository without telling Git the location of the remote repository. To solve this error, use the git remote add command to add a remote to your project.

Does not appear to be a git repository but it is?

The “… does not a appear to be a git repository” error is triggered when you try to clone, or run other commands, in a directory that is not recognized as a Git repository. The directory or remote file path might not have initialized Git, or the file path you are trying to access as an active repository is incorrect.

Does not appear to be a git repository please make sure you have the correct access rights?

The “Please make sure you have the correct access rights” error occurs if you do not have the right permissions to access a Git repository. To solve this error, make sure you are referring to the correct remote URL and that you have set up SSH authentication correctly.


1 Answers

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.

like image 125
ElpieKay Avatar answered Sep 18 '22 14:09

ElpieKay