我是 GCP 的新手,正在尝试将我的存储库 git 推送到运行 Debian 的 GCP 计算引擎。
我下载了gcloud命令工具并运行了
gcloud compute config-ssh
这给了我输出 ssh golub-vm.us-west1-a.golub-182114
。
之后我做了一个
gcloud compute ssh golub-vm
并在 ~/apps/golub/golub.git 中创建了一个远程裸 git 存储库
所以我通过以下方式将它作为远程添加到我的本地存储库:
git remote add gsrvr golub@golub-vm.us-west1-a.golub-182114:/apps/golub/golub.git
并尝试 push ,但我得到了一个
D:\golub>git push gsrvr master
bash: git-receive-pack: command not found
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
注意:我确保 /apps/golub/golub.git
归 golub:root
所有。我做错了什么?
哦,我尝试使用 gcloud compute scp
将本地文件复制到服务器,它工作正常,所以所有权应该没有任何问题,对吧?
我正在运行 Bitnami LAMP 图像。所以完整路径将是 /opt/bitnami/apps/golub/golub.git
最佳答案
先试试:
ssh -Tv golub@golub-vm.us-west1-a.golub-182114
这将向您显示 ssh 正在尝试使用哪些 ssh 公钥/私钥来打开远程安全 session 。
考虑 gcloud compute config-ssh很可能会创建一个 ~/.ssh/config 文件,这意味着要使用的 ssh URL 不是 user@server
而是在该文件中看到的别名。
Each instance will be given an alias of the form
NAME.ZONE.PROJECT
.
For example, if example-instance resides inus-central1-a
, you can SSH to it by running:
ssh example-instance.us-central1-a.MY-PROJECT
关于Git 推送到谷歌云计算引擎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46612175/