相关疑难解决方法(0)

在docker文件中将私钥添加到ssh-agent

我正在尝试为angular cli项目编写一个docker文件,但我有一个外部依赖项,它是BitBucket上的私有仓库,所以我需要传递我的ssh密钥.我正在尝试使用ssh密钥--build-arg

现在的问题是,它没有将这些密钥添加到ssh-agent并要求输入密码.

我正在使用此命令运行 docker build -t ng-2-docker/client --build-arg ssh_prv_key="$(cat ~/.ssh/id_rsa)" --build-arg ssh_pub_key="$(cat ~/.ssh/id_rsa)" .

这是我的docker文件

ARG ssh_prv_key
ARG ssh_pub_key

# Use an official Node runtime as a parent image
FROM node:8.9.4

# Specify working directory in docker container
WORKDIR /app

# Authorize SSH Host
RUN mkdir -p /ssh/
RUN chmod 0700 /ssh

# Add the keys and set permissions
RUN echo "$ssh_prv_key" > /ssh/id_rsa && echo "$ssh_pub_key" > /ssh/id_rsa.pub && chmod 600 /ssh/id_rsa && chmod 600 /ssh/id_rsa.pub

# …
Run Code Online (Sandbox Code Playgroud)

git ssh docker dockerfile

7
推荐指数
3
解决办法
5033
查看次数

docker 中的 ssh-add - 无法打开与您的身份验证代理的连接

我正在尝试为我的 Python Flask API 创建一个 docker 镜像。

我需要 git 来安装依赖项,而且我已经在 docker 中安装了几次 git。但在这里,我无法理解我做错了什么。

与码头工人:

FROM python:3.6-slim

ARG ssh_prv_key
ARG ssh_pub_key

RUN apt-get update && \
    apt-get install -y openssh-server &&\
    apt-get install -y git

# Authorize SSH Host
RUN mkdir -p /root/.ssh && \
    chmod 0700 /root/.ssh && \
    ssh-keyscan github.com > /root/.ssh/known_hosts

# Add the keys and set permissions
RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa && \
    echo "$ssh_pub_key" > /root/.ssh/id_rsa.pub && \
    chmod 600 /root/.ssh/id_rsa && \
    chmod 600 …
Run Code Online (Sandbox Code Playgroud)

git ssh ssh-agent docker

7
推荐指数
1
解决办法
1万
查看次数

GitExtensions + Putty通过SSH自定义端口

我有一个git存储库,我使用类似于此的路径拉取:

git pull ssh://username@host.com:1234/path/to/repository.git
Run Code Online (Sandbox Code Playgroud)

当GitExtensions然后尝试使用plink从repo中提取时,它会进行以下调用:

plink -T username@host.com:/path/to/repository.git
Run Code Online (Sandbox Code Playgroud)

这最终失败了,因为它实际上正在ping端口#22,而不是#1234.

正确的召唤将是

plink -T -P 1234 username@host.com:/path/to/repository.git
Run Code Online (Sandbox Code Playgroud)

如果我在〜/ .ssh/config中创建一个别名"hostCom",它似乎正常工作(连接到#1234),如果我这样做:

plink -T username@hostCom
Run Code Online (Sandbox Code Playgroud)

但是,只要我添加git repo的路径,它就会再次进入#22.

我尝试的另一个选项是在putty中创建一个会话,让我们称之为"hostPutty",并在那里设置默认端口等.尽管底线最终是相同的:无法将路径与git repo与自定义端口组合.

如何组合所有部件以使其工作?

为什么OpenSSH可以解决这个问题,但Putty不能解决?OpenSSH的唯一问题是它在每次连接尝试时一直要求我输入私钥的密码(我不想在没有密码的情况下创建私钥).

git ssh putty git-extensions

6
推荐指数
1
解决办法
7380
查看次数

Maven 发布插件挂在 git push 上

我正在遵循此处列出的有关如何发布到 Sonatype 的说明,但我遇到了该mvn release:prepare步骤的问题。到了这一步,它就停止了:

[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: C:\Users\Nicholas\git\Maven-Mule-REST-Plugin
[INFO] Executing: cmd.exe /X /C "git push git@github.com:NicholasAStuart/Maven-Mule-REST-Plugin.git master:master"
[INFO] Working directory: C:\Users\Nicholas\git\Maven-Mule-REST-Plugin
Run Code Online (Sandbox Code Playgroud)

我自己手动运行了那个命令,它要求我输入密码,但我假设这就是发布插件停滞的原因。这是一台 Windows 机器。我怎样才能让这个提示我,或者我可以在 mvn 的 CLI 参数中提供这个?

java git maven

4
推荐指数
2
解决办法
3190
查看次数

“无法打开与您的身份验证代理的连接”,即使在 ssh-agent 启动后也出现 ssh-add 错误

我需要添加多个 ssh 密钥,所以我需要执行 ssh-add

但我得到错误 Could not open a connection to your authentication agent

我阅读了很多帖子,例如无法打开与您的身份验证代理的连接https://superuser.com/questions/901568/ssh-agent-could-not-open-connection

我已经启动了 ssh-agent

eval ($ssh-agent -s)
Run Code Online (Sandbox Code Playgroud)

输出类似于:Agent pid 13524

但仍然收到此错误:

 $ ssh-add ~/.ssh/id_rsa
 Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud)

我也设置

git config --global url."https://".insteadOf git://
Run Code Online (Sandbox Code Playgroud)

我回显一些变量并得到这个:

echo $SSH_AGENT_PID
12340 
echo $SSH_AUTH_SOCK 
/tmp/ssh-ZbRZr10908/agent.10908
Run Code Online (Sandbox Code Playgroud)

PS:我使用的是Windows 7和公司下的网络。

git ssh gitlab

4
推荐指数
2
解决办法
1万
查看次数

无法在 ubuntu 上打开与身份验证代理、ssh 的连接

我花了很多时间来解决,但我的 ssh 仍在运行

wahyono17@komputer2:~$ ps -e |grep [s]sh-agent
 2311 ?        00:00:00 ssh-agent
 2343 ?        00:00:00 ssh-agent
Run Code Online (Sandbox Code Playgroud)

但是当我添加 ssh 时出现错误

wahyono17@komputer2:~$ sudo ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud)

当我尝试下一步时出现错误

wahyono17@komputer2:~$ sudo ssh-add -L
Could not open a connection to your authentication agent
Run Code Online (Sandbox Code Playgroud)

我尝试直接检查 github 连接,但出现错误

wahyono17@komputer2:~$ sudo ssh -T git@github.com
Permission denied (publickey)
Run Code Online (Sandbox Code Playgroud)

public已经在github中,我已经将公钥保存到github中,但仍然有错误

感谢帮助

github

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

git ×5

ssh ×4

docker ×2

dockerfile ×1

git-extensions ×1

github ×1

gitlab ×1

java ×1

maven ×1

putty ×1

ssh-agent ×1