Git push error: origin does not appear to be a git repository

551    Asked by ManishNagar in Devops , Asked on May 10, 2021

I am following the instructions given here to create a Git repository. All went well until the last line:

$ git push -u origin master  

I'm getting this: 

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

fatal: The remote end hung up unexpectedly

I'm using git version 1.7.11.3 on OS X 10.6.8

$ git remote -v  

returns nothing

Config file for the repository:

[core]

repositoryformatversion = 0  

filemode = true  

bare = false

logallrefupdates = true  

ignorecase = true  

I've had to open the sudoers file using sudo visudo command and add the following to it (under # User privilege specification):

git ALL=(ALL) ALL.  

Now if I do:

$ git remote add origin /Volumes/500GB/git-repository/myproject.git  

it comes back with no error, but I don't see any code in the repository (it has the aforementioned directories like branches, hooks, ...)

If I do:

$ git push -u origin master  

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

fatal: The remote end hung up unexpectedly

$ git remote -v   

origin /Volumes/500GB/git-repository/myproject.git (fetch)     

origin /Volumes/500GB/git-repository/myproject.git (push)

Answered by Abhinayan Verma

To solve fatal origin does not appear to be a git repository, here's what worked for me:

touch README.md

git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/tqisjim/google-oauth.git
git clone origin master

After cloning, the push command succeeds by prompting for a username and password.



Your Answer

Interviews

Parent Categories