Git 推送到谷歌云计算引擎

标签 git ssh google-cloud-platform

我是 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.gitgolub: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 in us-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/

相关文章:

git - 是否有可用的测试 GIT 存储库?

git - 接受 git 中的所有 merge 冲突

ssh - 无法 ssh 到 AWS EC2 : Identity file not accessible

firefox - 如何通过 SOCKS 5 代理发送所有 Windows 流量?

python - 有没有办法使用 Paramiko 和 Python 获取您连接的 SSH 服务器的横幅?

python - google-cloud 使用 python api 获取实例 ID 和区域

linux - 使用 Team Explorer Everywhere 命令行 Linux 在不下载所有项目的情况下在 TFS 中创建一个新的高级文件夹

r - 如何在 R studio 中恢复到以前的 git?

kubernetes - 将多个 Persistent Volume Claim 绑定(bind)到一个挂载路径

google-cloud-platform - PostgreSQL 数据库定期处于恢复模式