使用 git bash 时出现此错误的原因是什么
what is the reason of this error in using git bash
我是 git 的首发。
我正在使用 GitBush 并输入如下。
git clone [url]
git checkout -b [branch name]
修改了一些文件然后
git add .
git commit -m "[commit]"
git push origin [branch name]
但是我遇到了这样的错误:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
然后存储库上确实有一些分支
但是我执行命令:git分支,没有显示分支
但是在vscode的布什码头,做得很好!。
是什么原因。
有谁知道为什么会出现这样的错误?
感谢您的关注。
可能 origin
不是您的远程存储库的名称。
使用命令git remote -v
。输出将是 2 行(如果您只有 1 个远程设置),每行的第一个单词是远程名称。
或者您可以使用 git branch -r
来显示远程分支列表。它们将采用 remote-name/branch-name
的形式。远程名称可以是任何名称,origin 只是典型的默认值。
那么你的命令是 git push remote-name branch-name
(不是 git push remote-name/branch-name branch-name
,因为我认为这是一个常见的错误)。
我是 git 的首发。 我正在使用 GitBush 并输入如下。
git clone [url]
git checkout -b [branch name]
修改了一些文件然后
git add .
git commit -m "[commit]"
git push origin [branch name]
但是我遇到了这样的错误:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
然后存储库上确实有一些分支
但是我执行命令:git分支,没有显示分支 但是在vscode的布什码头,做得很好!。 是什么原因。 有谁知道为什么会出现这样的错误? 感谢您的关注。
可能 origin
不是您的远程存储库的名称。
使用命令git remote -v
。输出将是 2 行(如果您只有 1 个远程设置),每行的第一个单词是远程名称。
或者您可以使用 git branch -r
来显示远程分支列表。它们将采用 remote-name/branch-name
的形式。远程名称可以是任何名称,origin 只是典型的默认值。
那么你的命令是 git push remote-name branch-name
(不是 git push remote-name/branch-name branch-name
,因为我认为这是一个常见的错误)。