【问题标题】:ERROR : fatal: not a git repository (or any of the parent directories): .git cloud source repository错误:致命:不是 git 存储库(或任何父目录):.git 云源存储库
【发布时间】:2021-12-12 15:36:23
【问题描述】:

我正在尝试使用 cloud sdk 将代码从本地窗口推送到云源存储库,我关注的链接是

https://cloud.google.com/source-repositories/docs/authentication

在我的云 sdk 中运行第一个命令时

gcloud init && git config --global credential.https://source.developers.google.com.helper gcloud.cmd

它运行没有任何问题,但它没有在我的本地文件夹中生成 .git 文件夹,当我运行第二个命令时

git remote add google https://source.developers.google.com/p/la-gcp-test/r/demo-repo

我收到了这个错误

fatal: not a git repository (or any of the parent directories): .git

我要做的就是使用 cloud sdk 从本地 windows 机器上传一个简单的 index.html 文件到云源存储库。

【问题讨论】:

  • 第一个命令后,ls -apwd的输出是什么?运行第二个命令时,您似乎位于.git 目录中。

标签: git google-cloud-sdk google-cloud-source-repos


【解决方案1】:

正如您所怀疑的,您缺少git init,而这一定是在您可以git remote add 之前发生的。

如果您在遇到 git remote add 之前还没有初始化本地存储库,那么在您遇到 git remote add 之前只需 git init 即可

我很惊讶 Google 文档没有包含它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-23
    • 1970-01-01
    • 2012-06-30
    • 2012-08-11
    • 1970-01-01
    相关资源
    最近更新 更多