简体   繁体   English

通过 SSH 进行 Git 拉取

[英]Git pull via SSH

I try set up jenkins for automatically execute git pull from bitbucket.我尝试设置 jenkins 以自动从 bitbucket 执行git pull I created an SSH on repository and executed ssh -T git@bitbucket.org and got response:我在存储库上创建了一个 SSH 并执行ssh -T git@bitbucket.org并得到响应:

authenticated via a deploy key.通过部署密钥进行身份验证。 You can use git or hg to connect to Bitbucket.您可以使用 git 或 hg 连接到 Bitbucket。 Shell access is disabled.This deploy key has read access to the following repositories:外壳访问被禁用。此部署密钥对以下存储库具有读取访问权限:

If I try execute ssh git pull the console does infinite loading.. Why?如果我尝试执行ssh git pull控制台会无限加载..为什么?

There is no need to manually open SSH connection - git will do it itself.不需要手动打开 SSH 连接 - git 会自己做。 You just need to tell git to pull a specify from which repository.你只需要告诉 git 从哪个存储库中提取一个指定。 Git will parse the URL, and invoke SSH if needed. Git 将解析 URL,并在需要时调用 SSH。

And this is the best practice to disable shell access to git hosts.这是禁用对 git 主机的 shell 访问的最佳实践。 See eg https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server参见例如https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server

Did you clone repository?你克隆了存储库吗? You should be able to login to Bitbucket web interface and in you profile add your public SSH key.您应该能够登录到 Bitbucket Web 界面并在您的配置文件中添加您的公共 SSH 密钥。 Then you can clone repository.然后你可以克隆存储库。 From Bitbucket webinterface --> repo --> click on clone.从 Bitbucket 网络界面 --> 存储库 --> 单击克隆。 This will pop up window with ssh command to clone repository.这将弹出带有 ssh 命令的窗口来克隆存储库。 Once you repo is cloned, you should be able to use克隆 repo 后,您应该可以使用

    git pull
    ...edit,add,commit
    git push

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM