安装了ubuntu的两台笔记本电脑。
这些系统上用户1的ssh和git配置是相同的设置。
cat /home/user1/.ssh/config
Host system1
Hostname <system1_ip>
User user1
IdentityFile ~/.ssh/id_rsa_common
cat /home/user1/.gitconfig
[user]
email = user1@gmail.com
name = user1
这些系统中的Rsa私钥/公钥也相同
user1@system1:~/.ssh$ ls -al
total 28
drwx------ 2 user1 user1 4096 Apr 18 00:09 .
drwxr-xr-x 50 user1 user1 4096 Apr 18 00:06 ..
-rw------- 1 user1 user1 408 Feb 18 2017 authorized_keys
-rw-rw-r-- 1 user1 user1 91 Apr 18 00:04 config
-r-------- 1 user1 user1 1675 Feb 24 2017 id_rsa_common
-rw-r--r-- 1 user1 user1 408 Feb 24 2017 id_rsa_common.pub
-rw-r--r-- 1 user1 user1 1550 Apr 12 19:51 known_hosts
user1@system2:~/.ssh$ ls -al
total 24
drwxrwxr-x 2 user1 user1 4096 Apr 17 20:12 .
drwxr-xr-x 21 user1 user1 4096 Apr 17 23:08 ..
-rw-rw-r-- 1 user1 user1 91 Apr 17 20:12 config
-r-------- 1 user1 user1 1675 Apr 17 20:12 id_rsa_common
-rw-r--r-- 1 user1 user1 408 Apr 17 20:12 id_rsa_common.pub
-rw-r--r-- 1 user1 user1 1550 Apr 17 20:12 known_hosts
在system1中创建的git存储库。
user1 @ system2可以正确地执行“git clone”
user1@system2:~/job/test$ git clone ssh://<system1_ip>/home/git_root/mypicture.git
Cloning into 'mypicture'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
orion@ubuntu-pavilion:~/job/test$ ls -al mypicture/
total 12
drwxrwxr-x 3 user1 user1 4096 Apr 18 01:38 .
drwxrwxr-x 3 user1 user1 4096 Apr 18 01:38 ..
drwxrwxr-x 7 user1 user1 4096 Apr 18 01:38 .git
user1 @ system1尝试“git clone”
响应是权限被拒绝(公钥)。
user1@system1:~/job/git_test/local/temp$ git clone ssh://<system1_ip>/home/git_root/mypicture.git
Cloning into 'mypicture'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
使用此命令进行调试:
GIT_SSH_COMMAND =“ssh -vvv”git clone ssh://system1_ip/home/git_root/mypicture.git
部分转储显示无法找到私钥:
...
debug1: SSH2_MSG_NEWKEYS received
debug2: key: /home/user1/.ssh/id_rsa ((nil))
debug2: key: /home/user1/.ssh/id_dsa ((nil))
debug2: key: /home/user1/.ssh/id_ecdsa ((nil))
debug2: key: /home/user1/.ssh/id_ed25519 ((nil))
....
debug1: Trying private key: /home/user1/.ssh/id_rsa
debug3: no such identity: /home/user1/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/user1/.ssh/id_dsa
debug3: no such identity: /home/user1/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/user1/.ssh/id_ecdsa
debug3: no such identity: /home/user1/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/user1/.ssh/id_ed25519
debug3: no such identity: /home/user1/.ssh/id_ed25519: No such file or directory
如何在system1上将user1 @ system1的ssh / git config或someghing else更改为“git clone”此存储库?
答案 0 :(得分:1)
我冒昧地猜测,过于宽松的android.proguardKeep=-keep class com.mypackage.ProblemClass { *; } -keep class android.support.v4.** { *; } -keep class android.support.v7.** { *; } -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.app.Activity -keep public class * extends android.preference.Preference -keep public class com.freshdesk.mobihelp.exception.MobihelpComponentNotFoundException -keepclassmembers class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }
正在绊倒你的ssh,试着将其限制为${HOME}/.ssh/config
。查看详细输出,它会尝试键的默认名称,而不是0600
您指定的名称。
您也可以更正系统二的权限。通常~/.ssh/id_rsa_common
为$HOME/.ssh/
和0700
,密钥以及config
和known_hosts
为authorized_hosts
。
然而,根据可用信息,它只是一个猜测。有一件事让我感到困扰(但可能是* buntu特定的),我的0600
会拒绝ssh
在您的系统上看到的permbits,但它也会让我知道它在控制台上这样做{ {1}}。
希望这有帮助。
答案 1 :(得分:0)
尝试以下方法:
ssh-add
除非您提供要添加的特定密钥,否则将添加默认密钥
ssh-add
是一个用于将SSH私钥添加到SSH身份验证代理中以使用SSH实现单点登录的命令。代理进程称为ssh-agent
请阅读以下内容,了解如何运行它。
eval $(ssh-agent)
这将启动ssh代理并打印出servive的PID。
ssh-agent
是一个帮助程序,用于跟踪用户的身份密钥及其密码。然后,代理可以使用密钥登录其他服务器,而无需用户再次键入密码或密码。
答案 2 :(得分:0)
根本原因是user1 @ system1在执行ssh://system1_ip
时无法识别git clone
。
${HOME}/.ssh/config
仅在Host system1
而非Host system1_ip
如果user1 @ system1应用ssh://system1
但到目前为止我还不知道为什么user1 @ system2可以指定ssh://system1_ip
的密钥。