You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Git多账号配置异常:公司GitLab克隆超时并提示权限错误

公司GitLab账号SSH连接超时问题

个人GitHub账号可正常通过SSH使用,但公司GitLab账号始终无法工作。已查阅大量资料并严格遵循操作步骤,问题仍未解决。

现有配置详情

SSH配置文件(路径:~/pc.user/.SSH/config)

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.SSH/id_personal

Host gitlab.company.com
    HostName gitlab.company.com
    User git
    IdentityFile ~/.SSH/id_company

.SSH目录文件清单

$ ls ~/.SSH
config  id_company  id_company.pub  id_personal  id_personal.pub

密钥与仓库信息

  • 已反复检查个人GitHub和公司GitLab账号的SSH公钥注册情况,甚至删除后重新添加,确认配置无误
  • 公司GitLab仓库克隆地址:git@gitlab.company.com:shaima.mahmoud/my-test-project.git

执行克隆时的错误信息

进入~/CompanyGitLabRepos目录执行克隆命令后,出现以下错误:

cd ~/CompanyGitLabRepos
$ git clone git@gitlab.company.com:shaima.mahmoud/my-test-project.git
Cloning into 'my-test-project'...
ssh: connect to host gitlab.company.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

额外说明

已删除全局配置文件~/.gitconfig

内容的提问来源于stack exchange,提问作者Shima Mahmoud

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 18:36:23