使用Google Cloud SDK初始化存储库

时间:2014-09-11 03:23:51

标签: git google-cloud-storage gcloud

我正在使用Google Developers Console为Chrome扩展程序设置项目。我安装了Google Cloud SDK没有问题,但是当我尝试在扩展程序的文件夹中运行gcloud init my-extension-111时,收到以下错误消息:

Initialized gcloud directory in [C:\_Projects\my-extension-111\.gcloud].
Cloning [https://source.developers.google.com/p/my-extension-111/r/default] into [default].
ERROR: Unable to initialize project [my-extension-111], cleaning up [C:\_Projects\my-extension-111].
ERROR: <gcloud.init> Cannot find git. PLease install git and try again.

You can find git installers at [http://git-scm.com/downloads], or use
your favorite package manager to install it on your computer.

这对我没有任何意义,因为我已经在我的计算机上安装了git多年,甚至在我的扩展程序的文件夹中从git bash运行git init。有人可以帮我解决这个错误,以便我可以上传我的源代码到GCloud吗?提前谢谢。

2 个答案:

答案 0 :(得分:1)

听起来git安装在您的计算机上的方式并没有将它放在您的系统路径上。具体来说,git bash是一个特殊的shell,它在系统路径上有git,但不会将其放在系统路径上以供任何其他工具使用。

gcloud和cmd.exe都使用PATH环境变量查找命令。如果您可以通过启动cmd.exe并输入git来运行git,那么glcoud也应该能够找到它。

尝试启动cmd.exe,输入git并查看是否找到该命令。如果没有,请将包含git的目录添加到PATH,然后重试。 (您可能需要重新启动。)

答案 1 :(得分:0)

使用“Google Cloud SDK Shell”在我的WIN 7电脑上遇到同样的问题。 我的PATH中有git,但只有“..git / cmd”文件夹。这适用于所有正常的git操作。

我将“.git / bin”文件夹添加到PATH中以使其与gcloud一起使用

  

路径C:\ Program Files(x86)\ Git \ bin;%PATH%

     

gcloud init my-extension-111

稍后更新git到版本1.9永久解决了这个问题