尽管远程是 ssh,git 仍要求输入 HTTPS 用户名/密码

尽管远程是 ssh,git 仍要求输入 HTTPS 用户名/密码

我尝试了遇到的所有解决方案,但似乎都不适用。

我的远程绝对是 100% ssh:

r        ssh://ubuntu@r/home/ubuntu/r (fetch)
r        ssh://ubuntu@r/home/ubuntu/r (push)

我可以从 repo 克隆并 ssh 进入,而无需输入密码。我的.ssh/config是正确的:

Host    r
    Hostname        r
    IdentityFile    ~/.ssh/arkadiy-r.pem
    IdentitiesOnly yes
    User ubuntu

我已经验证服务器接受该密钥:

Accepted publickey for ubuntu from xx.xx.xx.xx port 58761 ssh2: RSA fi:ng:er:pr:in:tt
debug1: monitor_child_preauth: ubuntu has been authenticated by privileged process
debug1: monitor_read_log: child log fd closed
debug1: PAM: establishing credentials


User child is on pid 1514
debug1: SELinux support disabled
debug1: PAM: establishing credentials
debug1: permanently_set_uid: 1000/1000
debug1: packet_set_postauth: called
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 0 win 2097152 max 32768
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype [email protected] want_reply 0
debug1: server_input_channel_req: channel 0 request env reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req env
debug1: server_input_channel_req: channel 0 request exec reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req exec
Starting session: command for ubuntu from xx.xx.xx.xx port 58761

但它仍然提示我输入 HTTPS(???)用户名/密码:

[master//mr]% git push r master        (arkadiy@helium:..ine/r/)
Username for 'https://r':

这是怎么回事?

答案1

假设你的用户名是“Arkadiy”

如果这仅适用于单个 repo,您​​可以通过转到 repo 根目录并输入来设置用户名

git config user.name "Arkadiy"

如果要为整个计算机类型设置它,请在命令窗口的任何位置:

git config --global user.name "Arkadiy"

相关内容