git - 无法通过 SSH 克隆

标签 git ssh rhodecode

我找到了this topic/thread但我的问题不是 RC 由错误的用户运行。我的 SSH 克隆 URL 如下所示:ssh://root@my.tld/another-test并且访问被拒绝。

但是,HTTP 克隆工作得很好。

我的公钥也在我的 RC 配置文件中。这是来自cat /var/log/auth.log的内容:

Jul 21 01:52:05 CODE sshd[21525]: Accepted publickey for root from [REDACTED] port 50481 ssh2: RSA SHA256:qwerty
Jul 21 01:52:05 CODE sshd[21525]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jul 21 01:52:05 CODE systemd-logind[847]: New session 1607 of user root.
Jul 21 01:52:06 CODE sshd[21525]: Received disconnect from [REDACTED] port 50481:11: disconnected by user
Jul 21 01:52:06 CODE sshd[21525]: Disconnected from user root [REDACTED] port 50481
Jul 21 01:52:06 CODE sshd[21525]: pam_unix(sshd:session): session closed for user root
Jul 21 01:52:06 CODE systemd-logind[847]: Removed session 1607.

不太确定我做错了什么。

/root/.rccontrol/community-1/rhodecode.ini我在 SSH 部分看到了这一点:
## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode

我想也许我应该使用 ssh.authorized_keys_file_pathAuthorizedKeysFile但是 rccontrol status不喜欢那样...

RHODECODE CONTROL VERSION: 1.23.0
Failed to parse /root/.rccontrol/community-1/rhodecode.ini
Invalid line ('AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode') (matched as neither section nor keyword) at line 589.
cat /root/.rccontrol/vcsserver-1/vcsserver.log 的输出:
KeyError: 'HEAD'
2019-07-21 02:02:22.883 [1099] INFO  [vcsserver.tweens] IP: 127.0.0.1 Request to path: `/git` time: 0.005s
2019-07-21 02:02:22.887 [<1099>  ] GNCRN 127.0.0.1       rqt:0.009307 200 51     "POST:/git " usr:- "-" "PycURL/7.43.0.2 libcurl/7.59.0 OpenSSL/1.0.2p zlib/1.2.11 libssh2/1.8.0 nghttp2/1.24.0"
2019-07-21 02:02:50.693 [1099] DEBUG [vcsserver.http_main] method called:assert_correct_path with kwargs:{} context_uid: [REDACTED]
2019-07-21 02:02:50.693 [1099] DEBUG [dogpile.lock] NeedRegenerationException
2019-07-21 02:02:50.693 [1099] DEBUG [dogpile.lock] no value, waiting for create lock
2019-07-21 02:02:50.694 [1099] DEBUG [dogpile.lock] value creation lock <dogpile.cache.region._LockWrapper object at 0x7f42aeecd590> acquired
2019-07-21 02:02:50.694 [1099] DEBUG [dogpile.lock] Calling creation function for not-yet-present value
2019-07-21 02:02:50.694 [1099] DEBUG [dogpile.lock] Released creation lock
2019-07-21 02:02:50.695 [1099] INFO  [vcsserver.tweens] IP: 127.0.0.1 Request to path: `/git` time: 0.002s
2019-07-21 02:02:50.695 [<1099>  ] GNCRN 127.0.0.1       rqt:0.002517 200 51     "POST:/git " usr:- "-" "PycURL/7.43.0.2 libcurl/7.59.0 OpenSSL/1.0.2p zlib/1.2.11 libssh2/1.8.0 nghttp2/1.24.0"
2019-07-21 02:02:50.869 [1099] DEBUG [vcsserver.http_main] http-app: handling git stream
2019-07-21 02:02:50.869 [1099] DEBUG [vcsserver.http_main] LFS: Detecting if request `/another-test/info/refs` is LFS server path based on content type:``, is_lfs:False
2019-07-21 02:02:50.869 [1099] DEBUG [vcsserver.http_main] LFS: fallback detection by path of: `/another-test/info/refs`, is_lfs:False
2019-07-21 02:02:50.869 [1099] DEBUG [vcsserver.http_main] http-app: starting app handler with <vcsserver.scm_app.GitHandler object at 0x7f42aeecd590> and process request
2019-07-21 02:02:50.878 [1099] INFO  [vcsserver.tweens] IP: 127.0.0.1 Request to path: `/another-test/info/refs` time: 0.010s
2019-07-21 02:02:50.879 [<1099>  ] GNCRN 127.0.0.1       rqt:0.010726 200 38     "GET:/another-test/info/refs service=git-upload-pack" usr:- "-" "git/2.20.1 (Apple Git-117)"

编辑:目前,我通过 git config --global credential.helper store 使用存储的 git 凭据(从我的本地机器)所以我可以克隆我的私有(private)仓库。虽然这是不希望的,但 SSH 操作应该可以工作。

编辑 2:我没有得到这个也没有 RhodeCode token 工作,所以它是 git 凭据。如果我弄清楚问题/解决方案,我会在这里更新。

最佳答案

I thought maybe I should be using ssh.authorized_keys_file_path



您应该确保公钥在 ssh.authorized_keys_file_path 中。文件,即~/.ssh/authorized_keys_rhodecode无需触摸rhodecode.ini如果您使用 rccontrol enable-module ssh {instance-id} ,如 per the documentation .

问题是 more about LFS though :
except KeyError:
    log.exception('LFS, failed to extract data')

关于git - 无法通过 SSH 克隆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57138683/

相关文章:

git - 'cherry' 在 git-cherry 中意味着什么?

git - TortoiseGit 准备好迎接黄金时段了吗?

mysql - 如何在 ruby​​ 中创建 ssh 隧道,然后连接到远程主机上的 mysql 服务器

git - 我可以使用自定义标志扩展 git 命令吗?

Google Cloud Platform 上的 LAMP 堆栈中 MySQL 密码未知

ssh - 系统崩溃后恢复SSH session

mercurial - 如何从自定义 Hook 中读取配置设置?

mercurial - Rhodecode 存储库文件

git - 如何使用 'gem install' 命令从私有(private) GitHub 仓库安装 gem