我希望找到过去几天困扰我的问题的答案--我读了很多帖子、助手和出版物,但似乎找不到解决办法。我对SSH有点陌生。
问题如下:在使用go get
或go mod tidy
命令时,我无法获得/安装/刷新属于我的项目的模块,而在任何终端或TortoiseGit中,通过SSH进行相同回购的git clone
都可以正常工作,也就是说,我可以克隆,但不能构建。
获取模块失败的方式如下(个人数据混淆):
example.com/hello/PROJECTS/src/git.<orgname>.com/<reponame>/<subreponame>/tests/functional/resources tested by
example.com/hello/PROJECTS/src/git.<orgname>.com/<reponame>/<subreponame>/tests/functional/resources.test imports
git.<orgname>.com/<reponame>/<subreponame>/tests/functional/resources/vm_specific: module git.<orgname>.com/<reponame>/<subreponame>/tests/functional/resources/vm_specific: git ls-remote -q origin in C:\GO\PROJECTS\pkg\mod\cache\vcs\a5d519aeafc0ac08e2b20d7c8a6a8b2cea11cda88cb058cf2ebcc079d07b260a: exit status 128:
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\<username>/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\<username>/.ssh/known_hosts2'
debug2: resolving "git.<orgname>.com" port <port>
debug3: resolve_host: lookup git.<orgname>.com:<port>
debug3: ssh_connect_direct: entering
debug1: Connecting to git.<orgname>.com [10.XXX.X.XX] port <port>.
debug1: Connection established.
...
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.9
debug1: Remote protocol version 2.0, remote software version APACHE-SSHD-2.4.0
debug1: compat_banner: no match: APACHE-SSHD-2.4.0
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to git.<orgname>.com:<port> as 'git'
...
debug1: Authentications that can continue: publickey
...
debug3: send packet: type 50
debug3: receive packet: type 52
Authenticated to git.<orgname>.com ([10.XXX.X.XX]:<port>) using "publickey".
...
debug1: Sending command: git-upload-pack '/scm/<reponame>/<subreponame>.git'
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug2: channel 0: rcvd ext data 106
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug2: chan_shutdown_read: channel 0: (i0 o1 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
debug3: channel 0: will not send data after close
debug2: channel 0: obuf_empty delayed efd 6/(106)
debug2: channel 0: written 106 to efd 6
Repository not found
The requested repository does not exist, or you do not have permission to access it.
debug3: channel 0: will not send data after close
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i3 o1 sock -1 wfd 5 efd 6 [write])
debug2: channel 0: output drain -> closed
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1 io 0x00/0x08)
debug3: send packet: type 1
Transferred: sent 3268, received 2200 bytes, in 0.2 seconds
Bytes per second: sent 15169.6, received 10212.1
debug1: Exit status 1
如果需要更完整的日志,我可以把它上传到某个地方。
最后一行ssh -T(vvv set as default) git@git.<orgname>.com
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to git.<orgname>.com ([10.XXX.X.XX]:<port>).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Entering interactive session.
debug1: pledge: filesystem full
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: set_sock_tos: set socket 3 IP_TOS 0x08
debug2: client_session2_setup: id 0
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
debug3: receive packet: type 100
debug2: channel_input_status_confirm: type 100 id 0
shell request failed on channel 0
我使用从OpenSSH的ssh-keygen生成的密钥派生的公钥,它是新生成的,并添加到我的Git配置文件中。因此,git clone
工作得很好,这已经让我发疯了。我已经有大部分模块无法在远程私有回购中进行检查,这甚至更疯狂。
我不喜欢这部分,这很可能意味着我的证书有问题-
使用"publickey“对git..com (10.XXX.X.XX:)进行身份验证。
而这部分,作为OpenSSH on AIX requests PKCS12 support by default when EFS is enabled and non-AIX systems may reject these PKCS12 requests.
debug2: channel 0: obuf\_empty delayed efd 6/(106) debug2: channel 0: written 106 to efd 6
请参阅下面配置中的更改。
我的环境:
Enterprise
go env: (个人数据混淆)
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\<username>\AppData\Local\go-build
set GOENV=C:\Users\<username>\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Program Files\Go\pkg\mod
set GONOPROXY=*.<orgname>.com;git.<orgname>.com/users/<username>
set GONOSUMDB=*.<orgname>.com;git.<orgname>.com/users/<username>
set GOOS=windows
set GOPATH=C:\Program Files\Go
set GOPRIVATE=*.<orgname>.com;git.<orgname>.com/users/<username>
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18.3
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\USER~1.NAM\AppData\Local\Temp\go-build1143995380=/tmp/go-build -gno-record-gcc-switches
我的SSH配置:
# GITHUB FOR SRC
Host git.<orgname>.com
ServerAliveInterval 600
TCPKeepAlive yes
IPQoS throughput
AddKeysToAgent yes
HostName git.<orgname>.com
Port <port>
User <username>
PreferredAuthentications publickey
IdentityFile C:\Users\<username>\.ssh\git_rsa
#IdentityFile ~/.ssh/git_rsa
PubkeyAcceptedKeyTypes +ssh-rsa
#ForwardAgent no
#AllowPKCS12KeystoreAutoOpen no
LogLevel DEBUG3
,正确的证书似乎被用作身份验证。
known-hosts
中没有完全未知的条目,并且使用了由证书时间戳判断的正确条目.AllowPKCS12KeystoreAutoOpen
设置为no
禁用,但是它被标记为一个糟糕的选项-C:\GO\PROJECTS\pkg\mod\cache\vcs\d0d607237eeba0d1c9d5ce996ed36c0f3746b2c8f94b538ace2d3f2a9476839e:退出状态128: C:\ C:\GO\PROJECTS\src\git..com\\>go \/..ssh/config:第15行:坏配置选项: allowpkcs12keystoreautoopen C:\Users\/..ssh/C:\GO\PROJECTS\src\git..com\\>go:终止,一个错误的配置选项
GIT吐露:
用户名= @.com url“ssh://git@git.com:/”insteadOf =@.com
url“ssh://git@git.com:/”insteadOf =insteadOf
git远程-v:
origin ssh://git@git.<orgname>.com:<port>/~<username>/<subreponame>.git (fetch)
origin ssh://git@git.<orgname>.com:<port>/~<username>/<subreponame>.git (push)
相同
回购配置:
[remote "origin"]
url = ssh://git@git.<orgname>.com:<port>/~<username>/<subreponame>.git
fetch = +refs/heads/*:refs/remotes/origin/*
我试过//和git@git..。但这没什么用。
然而,模块配置(自动设置):
[remote "origin"]
url = https://git.<orgname>.com/scm/<reponame>/<subreponame>.git
fetch = +refs/heads/*:refs/remotes/origin/*
我现在没有主意了。
发布于 2022-08-25 18:50:15
我建议不要在私有存储库中使用go get
。此命令在pkg.go.dev缓存存储库,从而将它们公开给世界。我很尴尬地发现,我们的私人发展公开发表在那里。
我手动地在文件系统中部署我的私有依赖项,并使用替换指定go.mod
中的依赖项:
require your.server/your/package 1.2.3
replace your.server/your/package 1.2.3 => /path/to/local/your/package
发布于 2022-09-08 17:36:17
这是存储库的一个问题--它实际上不是用来处理依赖关系的,也不是用来处理模块和模块相关请求的。但是至少我已经学到了很多关于SSH和GIT交互的知识。
https://stackoverflow.com/questions/73491769
复制相似问题