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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With