我正在尝试为多个SSH帐户创建一个.ssh/config文件(特别是对于github.com).我已经尝试了几个教程和github帮助演练,但似乎没有任何工作.
我创造了一个id_rsa_test和id_rsa_test.pub.我上传id_rsa_test.pub到github.
然后我创建了一个~/.ssh/config包含以下内容的文件:
# github account
Host github.com-test github.com
Hostname github.com
User git
IdentifyFile ~/.ssh/id_rsa_test
Run Code Online (Sandbox Code Playgroud)
和
# github account
Host github.com-test github.com
Hostname github.com
User git
IdentifyFile ~/.ssh/id_rsa_test.pub
Run Code Online (Sandbox Code Playgroud)
然后我尝试几个命令.即:
git clone git@github-test:username/my_project.git
git push
Run Code Online (Sandbox Code Playgroud)
...每次我收到以下错误:
/home/username/.ssh/config: line 5: Bad configuration option: IdentifyFile
/home/username/.ssh/config: terminating, 1 bad configuration options
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我正在尝试为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) 我正在使用MAC OS Yosemite,我想将一个17 MB的文件推送到我的github-Account。我在ssh和https上都尝试了git,但都没有用。
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push -u origin master返回最后6行:
Counting objects: 243, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (118/118), done.
packet_write_wait: Connection to 192.30.253.113 port 22: Broken pipe
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
在寻找解决方案时,我开始在各种配置脚本中设置TCPKeepAlive,ServerAlive,ClientAlive参数,最后以~/.ssh/config:
Host github.com
PubKeyAuthentication yes
IdentityFile ~/.ssh/id_rsa.pub
ServerAliveInterval 300
TCPKeepAlive no
#ServerAliveCountMax 2400
Run Code Online (Sandbox Code Playgroud)
在/etc/sshd_config:
# $OpenBSD: sshd_config,v 1.89 2013/02/06 00:20:42 dtucker Exp $
# This is …Run Code Online (Sandbox Code Playgroud)