错误:没有用户名,无法将某些引用推送到ssh

时间:2017-03-02 15:39:46

标签: jenkins ssh gerrit

由于此错误,我在将更改从Jenkins服务器推送到Gerrit服务器时出现问题:

+ git checkout origin/release_6.3.0
Previous HEAD position was 6c1313da... Fixes getting secret posts when searching posts by market.
HEAD is now at a9490de6... Fixes channels routes.
+ git rev-parse Deploy_Stage_6.3.0_RC210_Her
+ git tag Deploy_Stage_6.3.0_RC210_Her
+ git push origin Deploy_Stage_6.3.0_RC210_Her
debug1: Connecting to gerrit [XX.XX.XX.X] port 29418.
debug1: Connection established.
debug1: identity file /c/Users/mikz/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mikz/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mikz/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mikz/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mikz/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mikz/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mikz/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mikz/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version GerritCodeReview_2.12 (SSHD-CORE-0.14.0)
debug1: no match: GerritCodeReview_2.12 (SSHD-CORE-0.14.0)
debug1: Authenticating to gerrit:29418 as 'gerrit'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group1-sha1
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: ssh-rsa SHA256:lZ41xRL6gg58lbJKSIcYDlo54lUVj6lUFOCsj1zfKns
debug1: Host '[gerrit]:29418' is known and matches the RSA host key.
debug1: Found key in /c/Users/mikz/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/USER_NAME/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to gerrit ([XX.XX.XX.X]:29418).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending command: git-receive-pack 'PATH'
remote: 
remote: Processing changes: refs: 1, done            
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2904, received 252760 bytes, in 0.9 seconds
Bytes per second: sent 3225.7, received 280757.7
debug1: Exit status 0
To ssh://gerrit:29418/PATH
 ! [remote rejected]   Deploy_Stage_6.3.0_RC210_Her -> Deploy_Stage_6.3.0_RC210_Her (prohibited by Gerrit)
error: failed to push some refs to 'ssh://gerrit@gerrit:29418/PATH'
Build step 'Conditional step (single)' marked build as failure
Description set: 
Finished: FAILURE

可能这是因为在这一行:

至ssh:// gerrit:29418 / PATH

我没有用户名,但我不知道如何修复它
我在.gitconfig中添加了以下行但它不起作用:
[url" ssh:// gerrit @ gerrit:29418 /"]
    insteadOf = ssh:// gerrit:29418 /



任何想法如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

当你执行“git push origin BRANCH”时,你会直接跳到绕过Gerrit的分支。此错误(Gerrit禁止)表示“gerrit”用户无权执行此操作。您需要授予用户绕过代码审查的权限或在推送命令中使用“refs / for / BRANCH”。

在Gerrit文档here中查看有关此错误的更多详细信息。

答案 1 :(得分:0)