Windows上的Git - 无法使用本地(文件)协议推送到远程存储库

时间:2014-06-19 19:21:47

标签: windows git

我在Windows 7 Enterprise SP1 x64上使用Git版本1.9.2-preview20140411。

当我尝试使用本地(文件)协议推送到远程存储库时,出现错误:

  

致命:'orgin'似乎不是git存储库   致命的:无法从远程存储库读取。

以下是重现的步骤:

$ cat PushTestCase.sh
#!/bin/bash
set -o xtrace

cd /C/work/Git
git init --bare MyProjectBare
git clone MyProjectBare MyProjectClone
cd MyProjectClone
echo "apples, oranges" > fruit.txt
git add fruit.txt
git commit -a -m "First commit"
git push orgin master
git remote -v
git remote show orgin

$ PushTestCase.sh
+ cd /C/work/Git
+ git init --bare MyProjectBare
Initialized empty Git repository in c:/work/Git/MyProjectBare/
+ git clone MyProjectBare MyProjectClone
Cloning into 'MyProjectClone'...
warning: You appear to have cloned an empty repository.
done.
+ cd MyProjectClone
+ echo 'apples, oranges'
+ git add fruit.txt
warning: LF will be replaced by CRLF in fruit.txt.
The file will have its original line endings in your working directory.
+ git commit -a -m 'First commit'
warning: LF will be replaced by CRLF in fruit.txt.
The file will have its original line endings in your working directory.
[master (root-commit) 74ee22d] First commit
warning: LF will be replaced by CRLF in fruit.txt.
The file will have its original line endings in your working directory.
 1 file changed, 1 insertion(+)
 create mode 100644 fruit.txt
+ git push orgin master
fatal: 'orgin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
+ git remote -v
origin  c:/work/Git/MyProjectBare (fetch)
origin  c:/work/Git/MyProjectBare (push)
+ git remote show orgin
fatal: 'orgin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

$

最初我尝试使用网络驱动器上的远程存储库。为了消除任何可能的权限问题,我使用本地驱动器上的远程存储库重现了该问题。

我知道另一种选择是在服务器上设置SSH,但我更愿意使用本地协议来实现这一点。

1 个答案:

答案 0 :(得分:0)

您的脚本有拼写错误。正确的:

git push orgin master

为:

git push origin master