我在 Gitlab 上有一个已建立的帐户。我创建了一个新的空存储库。我完全复制了将现有文件夹推送到其中的说明。
cd existing_folder
git init --initial-branch=main
git remote add origin [email protected]:Joymaker3/CatandMouse.git
git add .
git commit -m "Initial commit"
git push --set-upstream origin main
一切都有效,直到最后的推送指令,然后失败了,给了我:
% git push --set-upstream origin main
remote:
remote: ========================================================================
remote:
remote: ERROR: The project you were looking for could not be found or you don't have permission to view it.
我去看了一下,发现我的 SSH 密钥已过期。所以我创建了另一个并将其粘贴到 Gitlab 的适当位置。然后我又尝试了推。完全相同的错误。
好吧,也许新存储库有些奇怪的东西。我尝试使用 SSH URL 克隆一个众所周知可以工作的现有存储库。同样的错误!
下一步:检查 SSH 连接
% ssh -vT [email protected]
OpenSSH_9.4p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/ken/.ssh/config
debug1: /Users/ken/.ssh/config line 9: Applying options for *
debug1: /Users/ken/.ssh/config line 14: Applying options for gitlab.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to gitlab.com port 22.
debug1: Connection established.
debug1: identity file /Users/ken/.ssh/id_ed25519 type 3
debug1: identity file /Users/ken/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.4
debug1: Remote protocol version 2.0, remote software version GitLab-SSHD
debug1: compat_banner: no match: GitLab-SSHD
debug1: Authenticating to gitlab.com:22 as 'git'
debug1: load_hostkeys: fopen /Users/ken/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw
debug1: load_hostkeys: fopen /Users/ken/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'gitlab.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/ken/.ssh/known_hosts:28
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /Users/ken/.ssh/id_ed25519 ED25519 SHA256:OfDLrUCWHOxRC1OltBjAU4IJdo8xzTCkz4H8bHbswQA explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss>
debug1: kex_input_ext_info: [email protected] (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/ken/.ssh/id_ed25519 ED25519 SHA256:OfDLrUCWHOxRC1OltBjAU4IJdo8xzTCkz4H8bHbswQA explicit
debug1: Server accepts key: /Users/ken/.ssh/id_ed25519 ED25519 SHA256:OfDLrUCWHOxRC1OltBjAU4IJdo8xzTCkz4H8bHbswQA explicit
Authenticated to gitlab.com ([172.65.251.78]:22) using "publickey".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: Sending environment.
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Welcome to GitLab, @Joymaker2!
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2156, received 1612 bytes, in 0.1 seconds
Bytes per second: sent 19642.5, received 14686.3
debug1: Exit status 0
看起来已连接!那么 Gitlab 建议的 URL 是否有问题?我过去一直在放弃并使用 https,但我真的很想把它做好!
我已经建立了 GitLab 帐户,最近创建了一个新的空存储库。我按照确切的说明将现有文件夹推送到这个新存储库,但有些东西似乎不起作用。我应该检查哪些提示或常见问题?