AnD*_*Dri 10 ssh timeout repository gitlab
我试图让 Gitlab 与 SSH 一起工作,但它不会。
我已经完成了以下步骤:
1) 生成 ssh 密钥
ssh-keygen -t rsa -C "myemail@myhoster.com" -b 4096
Run Code Online (Sandbox Code Playgroud)
2 ) 在文件夹 /Users/myUserName/.ssh/ 中将密钥命名为“id_rsa”
3)通过复制密钥
pbcopy < ~/.ssh/id_rsa.pub
Run Code Online (Sandbox Code Playgroud)
4)将密钥插入gitlab
当我现在尝试克隆存储库时,我收到以下错误:
$ git clone git@gitlab.com:myName/repositoryName/ repoName
Cloning into 'repoName'...
ssh: connect to host gitlab.com port 22: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
出了什么问题?
小智 11
我发现自己遇到了同样的问题。
正如Adrian Dymorz所描述的,您可以使用以下命令检查您是否可以通过 SSH 访问 Gitlab:
ssh git@gitlab.com
Run Code Online (Sandbox Code Playgroud)
你应该会收到这样的回复:
...
Welcome to GitLab, <Gitlab ID Account>!
Shared connection to altssh.gitlab.com closed.
Run Code Online (Sandbox Code Playgroud)
如果没有,那么betarrabara应该可以解决您的问题,但是您不应该提供您的id_rsa而是您的id_rsa.pub:
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.pub
Run Code Online (Sandbox Code Playgroud)
GitLab.com 运行第二个 SSH 服务器,该服务器侦听常用端口 443,该端口不太可能受到防火墙保护。
您所要做的就是编辑~/.ssh/config并更改连接到 GitLab.com 的方式。
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.pub
Run Code Online (Sandbox Code Playgroud)
来源:https://about.gitlab.com/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/
小智 5
我尝试了上述方法,但删除了最后一行中的 .pub,因为它说格式不正确。它已经奏效了。
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24244 次 |
| 最近记录: |