1

I am starter in git . I am using GitBush and entered as following.

git clone [url]
git checkout -b [branch name]

modified some files and then

git add .
git commit -m "[commit]"
git push origin [branch name]

But i encountered such error:

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

fatal: Could not read from remote repository.

And then there really are some branches on repository

But i execute command : git branch ,no branch showed But in vscode's bush terminal,it is well done!. what is the reason. Is anyone knows why such error occur? Thanks for your attention.

5
  • 3
    Possible duplicate of Git push error: "origin does not appear to be a git repository"
    – Liam
    Commented Nov 29, 2018 at 13:47
  • 3
    Start debugging with git remote -v.
    – phd
    Commented Nov 29, 2018 at 13:50
  • 4
    GitBush ... didn't know that former US presidents have a stake in the version control business :-) Commented Nov 29, 2018 at 13:53
  • 2
    hum: did you cd to fetched directory just after cloning
    – jo_
    Commented Nov 29, 2018 at 14:27
  • 2
    Possible things to check: 1. Are you registered with an SSH key on the remote repo? 2. Is this repo accessible from the network you are pushing from? 3. Is this repo private or internal and therefore can't be accessed? Please check those things and let us know.
    – Oren_C
    Commented Nov 29, 2018 at 14:35

1 Answer 1

2

It's possible origin is not the name of your remote repository.

Use the command git remote -v. The output will be 2 lines (if you have only 1 remote setup) with the first word on each line being the remote name.

Alternatively you can use git branch -r to show the list of remote branches. They will take the form of remote-name/branch-name. Remote name can be anything, origin is just the typical default.

Then your command is git push remote-name branch-name (NOT git push remote-name/branch-name branch-name as I've seen as a common mistake).

Not the answer you're looking for? Browse other questions tagged or ask your own question.