git pull over ssh 报错
git pull over ssh gives errors
这是我的设置。
- 我的 git 存储库在 bitbucket
- 我在我的远程 aws ec2 服务器上创建了密钥并将其保存在 ~/.ssh 文件夹中
- 然后我通过远程服务器上的 ssh-agent 添加密钥
- 在 bitbucket 网站上更新了这些密钥。
当我登录到我的远程服务器并在我的 git 存储库上 运行 "git pull" 时,一切正常。 这里没有问题。
但是当我在 windows 上通过 cygwin bash 运行 相同时,它给了我这个错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我在 windows 机器上执行以下操作
ssh -i xyz.pem user@ip -t 'sudo sh deploy.sh'
将 "deploy.sh"、cd 的 放入我的存储库并执行 git pull
.
为什么会出现这个问题? 我是否也应该将这些 ssh 密钥保存在我的 windows 机器上?
任何帮助都将是无价的。
我在 'sudo sh deploy.sh' 中使用 "sudo",这提示它检查根用户 .ssh 文件夹中的凭据。删除 "sudo",它工作正常。
这是我的设置。
- 我的 git 存储库在 bitbucket
- 我在我的远程 aws ec2 服务器上创建了密钥并将其保存在 ~/.ssh 文件夹中
- 然后我通过远程服务器上的 ssh-agent 添加密钥
- 在 bitbucket 网站上更新了这些密钥。
当我登录到我的远程服务器并在我的 git 存储库上 运行 "git pull" 时,一切正常。 这里没有问题。
但是当我在 windows 上通过 cygwin bash 运行 相同时,它给了我这个错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我在 windows 机器上执行以下操作
ssh -i xyz.pem user@ip -t 'sudo sh deploy.sh'
将 "deploy.sh"、cd 的 放入我的存储库并执行 git pull
.
为什么会出现这个问题? 我是否也应该将这些 ssh 密钥保存在我的 windows 机器上? 任何帮助都将是无价的。
我在 'sudo sh deploy.sh' 中使用 "sudo",这提示它检查根用户 .ssh 文件夹中的凭据。删除 "sudo",它工作正常。