7

I am trying to use deployment keys for a repository which belongs to an organization (for which I am an administrator).

I created a private/public key pair, the public was pasted into the 'deployment keys' window, and accepted. I then tried to connect via git pull from a distant repository:

git add origin git@myserver.com:/organization/therepo.git
git pull

I keep being asked for the password for the user git. I tried to use instead the users git, gogs, <my login>, <the name or the organization> -- I am being asked for the password every time.

I tried a simple ssh -v to check which key is provided to gogs: it is the right one (the private key above, corresponding to the deployment (public) key).

Which user should I use to connect?

4

1 回答 1

4

故障排除想法的所有功劳归功于David Cullen(通过他的评论)

问题是我调用了错误的sshd服务

我的 GOGS 服务在 docker 中运行,并且ssh端口与主机服务器之一不同(这是我使用默认端口 22 调用的):

# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                           NAMES
86ddbabc8cbb        gogs/gogs           "docker/start.sh /bin"   13 days ago         Up 3 minutes        0.0.0.0:3000->3000/tcp, 0.0.0.0:10022->22/tcp   gogs

通过使用像这样的 ~/.ssh/config 文件

Host    my.git.server.com
        Port 10022
        IdentityFile    /var/www/.ssh/my.private.key.openssh
        IdentitiesOnly yes

我现在成功地从远程服务器中提取了 GOGS 存储库:

$ git pull ssh://git@my.git.server.com:/organisation/therepo
From ssh://my.git.server.com:/organisation/therepo
 * branch            HEAD       -> FETCH_HEAD
Already up-to-date.

请注意前面有一个斜线organisation(re:最初的评论)

于 2016-07-01T08:01:22.433 回答