Anh Bui
Anh Bui

Reputation: 11

Git push origin master -f : "fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository."

I know my question looks similar to some questions, but I think that my problem is something new maybe.

$ git init  #  Make a new repository
$ git add -A   # Add all the files which have not been added
$ git commit -m "Initialize repository"  
$ git push origin master -f

My problem is, when I command git push origin master -f, it shows me this error:

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

Could you please give me some ideas?

Upvotes: 0

Views: 4661

Answers (1)

user404
user404

Reputation: 2028

It seems you haven't pointed your local to any remote branch. Check your remote by this command:

git remote -v

you will see something like this:

origin http:link_to_your_repo/repo_name.git (fetch)
origin http:link_to_your_repo/repo_name.git (push)

If this command fails, that means you have to add your remote origin(I assume this is your case). If there is no remote branch, create one. Now point to this remote branch of your local.

`git remote add origin [email protected]:user/your_remote_repo.git` //***[you will get this link when you create one]***

Now push your changes:

git push origin master

This should work.

Upvotes: 2

Related Questions