我正在一家公司写我的学士论文,并从管理员那里获得了 gitlab 的访问权限,但我是 Git 的新手。我为我的论文创建了一个新项目。我的电脑上已经有一个文件夹,里面有一些东西。我在 git bash 中使用了以下命令(按照 gitlab 的推荐):
git init
git remote add origin git@gitlab:USER/TITLE.git
git add [stuff]
git commit
git push -u origin master
提交成功,但最后一个命令产生了错误
"ssh: connect to host gitlab port 22: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists."
我试图切换到端口 443,因为显然这是一回事。
ssh -T -p 443 git@altssh.gitlab.com
这让我:
"The authenticity of host '[altssh.gitlab.com]:443 ([35.190.168.187]:443)' can't be established.
ECDSA key fingerprint is [...].
Are you sure you want to continue connecting (yes/no/[fingerprint])?"
输入 yes 后:
"Warning: Permanently added '[altssh.gitlab.com]:443,[35.190.168.187]:443' (ECDSA) to the list of known hosts.
git@altssh.gitlab.com: Permission denied (publickey)."
返回端口 22 时,连接超时。
push命令后的错误还是一样。
根据 canyouseeme.org,端口 22 和 443 未打开。
我还尝试为 Windows Defender 防火墙菜单中的端口制定新规则。
还是一样的错误。
我真的很感激你的任何帮助或想法:)
彼得
最佳答案
我解决了,没那么难。
ssh 不行,这里大家都用http。
我从 gitlab 复制了错误的 url。
我必须使用的命令是:
git remote set-url origin http://gitlab/USER/PROJECT.git
关于git - Git : "ssh: connect to host gitlab port 22: connection refused" 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58416740/