我尝试用ssh从一个私有的自托管gitlab repo导入一个go项目,当我尝试这样做时,我得到了如下错误。
输出
kbacon@kbacons-MacBook-Pro bbz % go get -x gitlab.wtf.notworking/bbq/tools@latest
# get https://gitlab.wtf.notworking/bbq/tools?go-get=1
# get https://gitlab.wtf.notworking/bbq/tools?go-get=1: 200 OK (0.413s)
mkdir -p /Users/kbacon/go/pkg/mod/cache/vcs # git3 https://gitlab.wtf.notworking/bbq/tools.git
# lock /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179.lock# /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179 for git3 https://gitlab.wtf.notworking/bbq/tools.git
cd /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179; git tag -l
0.013s # cd /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179; git tag -l
cd /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179; git ls-remote -q origin
0.020s # cd /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179; git ls-remote -q origin
# get https://gitlab.wtf.notworking/bbq/tools.git
# get https://gitlab.wtf.notworking/bbq/tools.git: 200 OK (0.186s)
go: gitlab.wtf.notworking/bbq/tools@v1.0.0: reading gitlab.wtf.notworking/bbq/tools/go.mod at revision v1.0.0: unknown revision v1.0.0
配置文件
[user]
name = kbacon
email = kbacon@email.com
[url "git@gitlab.wtf.notworking/"]
insteadof = https://gitlab.wtf.notworking/
执行模式文件
module bbz
go 1.14
require (
gitlab.wtf.notworking/bbq/tools v1.0.0
)
Git拉布回购公司
gitlab repo有一个带有发布标签v1.0.0
的项目
我用来克隆的地址
ssh://git@gitlab.wtf.notworking:2224/bbq/tools.git
使用这个. gitconfig:配置文件
[user]
name = kbacon
email = kbacon@email.com
[url "git@gitlab.wtf.notworking:2224/"]
insteadof = https://gitlab.wtf.notworking/
然后go get
命令请求我的密码,但是它应该使用ssh,为什么它要请求我的密码?
kbacon@kbacons-MacBook-Pro bbz % go get -x gitlab.wtf.notworking/bbq/tools@latest
# get https://gitlab.wtf.notworking/bbq/tools?go-get=1
# get https://gitlab.wtf.notworking/bbq/tools?go-get=1: 200 OK (0.424s)
mkdir -p /Users/kbacon/go/pkg/mod/cache/vcs # git3 https://gitlab.wtf.notworking/bbq/tools.git
# lock /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179.lock# /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179 for git3 https://gitlab.wtf.notworking/bbq/tools.git
cd /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179; git tag -l
0.030s # cd /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179; git tag -l
cd /Users/kbacon/go/pkg/mod/cache/vcs/3bd57e1dd1ed847c1ac192f16c5f67541135ce037a175de23ec5fb5051d10179; git ls-remote -q origin
git@gitlab.wtf.notworking's password:
2条答案
按热度按时间h43kikqp1#
如果您将SSH URL与
/
而不是:
一起使用,则.gitconfig
应为:带有“:“
epggiuax2#
似乎.gitconfig中缺少端口号
UPD:我看到如果你添加它,你会得到一个不同的错误,但显然端口号是必要的,因为你运行ssh的非标准端口。