Author
Author

Reputation: 455

what is the reason of this error in using git bash

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.

Upvotes: 1

Views: 1275

Answers (1)

Geraden
Geraden

Reputation: 216

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).

Upvotes: 2

Related Questions