Talk:Gerrit/git-review

importance of scp

edit

For those (windows users?) having trouble exec'ing git review -R, it works nicely to run the suggested scp command (please note that the shell used by git in windows puts stray characters at the end of lines, so IGNORE "←[K" in the following):

 mylocaldir>git review -R
 Enter passphrase for key '/c/Users/myusername/.ssh/id_rsa':
 Enter passphrase for key '/c/Users/myusername/.ssh/id_rsa':
 remote: Processing changes: refs: 1, done    ←[K
 remote: ERROR: missing Change-Id in commit message footer←[K
 remote: Suggestion for commit message:←[K
 remote:
 remote: Change-Id: I8155f3c92111ae8228e7ac1970225ddef73a88bc←[K
 remote:
 remote: Hint: To automatically insert Change-Id, install the hook:←[K
 remote:   scp -p -P 29418 myusername@gerrit.wikimedia.org:hooks/commit-msg .git/hooks/←[K

In other words, run the suggested "scp" command and your life will be more pleasant/ Hypergrove (talk) 18:46, 2 March 2013 (UTC)Reply

Gerrit/git-review#Windows suggests to "run scp -v -P 29418 <USERNAME>@gerrit.wikimedia.org:hooks/commit-msg . from within the repo's .git/hooks directory". I believe using the path directly in the command instead of . is clearer, but I also would like to know which of the two other options that differ (-v and -p) should be kept in the instructions on that page. Any insights? Waldir (talk) 10:44, 4 March 2013 (UTC)Reply

C:\Program: bad interpreter

edit
If you get C:\Program: bad interpreter when running git-review from the git bash shell on Windows (this happens when Pythong is installed inside the Program Files folder), you can fix it by opening the git-review script file (probably C:\Program Files\Python\PythonXX\Scripts\git-review) and in the first line (the one starting with #!) changing Program Files to Progra~1. Tgr (talk) 22:50, 3 March 2013 (UTC)Reply
I had the same problem. This fix worked. I had already used the Progra~1 substitution in the git-review.bat file.
My installation of git-review resides at C:\Program Files\Python27\Scripts\
There is a bug report here. Bcharles (talk) 19:49, 4 September 2013 (UTC)Reply
So after 5 years this has changed a bit. I went into the directory at: `C:\Program Files\Python27\Scripts\`
I had no git-review file but I did have a plain old `aws` file without an extension. I opened this and changed the `Program Files` piece of the directory path to `Progra~1` as mentioned by the others.
Thanks! 12.1.141.146 (talk) 19:32, 11 September 2018 (UTC)Reply
thanks

144.202.102.34 (talk) 09:14, 29 November 2018 (UTC)Reply

tag or topic?

edit

The section "What happens when you submit a change" uses the term "tag" referring to the "t" option's argument. However, the git-review documentation refers to that argument as the "topic", which is consistent with how this concept is referred to in Gerrit.

Moreover, "tag" has another very common use in Git (viz, git-tag), which makes it even more confusing.

I'd like to propose to substitute "topic" for "tag" in that section. Gnustavo (talk) 15:33, 3 August 2013 (UTC)Reply

Done 158.132.130.100 06:30, 7 August 2013 (UTC)Reply

High threshold for Windows users new to Gerrit

edit

The current state of git-review presents a series of obstacles for prospective gerrit users. Many windows users are likely turned away by the complex chain of installations and configurations. Resolving bugs in git-review on windows systems would help, but a single installer for git-review and its dependencies would retain more aspiring developers.

Pushing the features of git-review into git would be ideal. Bcharles (talk) 20:30, 4 September 2013 (UTC)Reply

Or we could just stop using the awful tool :\ ^demon[omg plz] 20:53, 10 September 2013 (UTC)Reply

Cannot sudo to install python-pip and git-review.

edit

On debian shared hosting, one cannot sudo so as to install python-pip and git-review. One could install them locally for ones user account, but how? Can anyone help extending the section on debian appropriately? Purodha Blissenbach (talk) 16:28, 16 February 2014 (UTC)Reply

Found a way and added a description. Purodha Blissenbach (talk) 14:16, 18 February 2014 (UTC)Reply

.gitremote or .gitreview?

edit

I'm confused about the references to git-remote and the .gitremote file. Should this really be the .gitreview file?

When I installed git-review and when I ran git remote -s, I got an error about a missing .gitreview file.

I created a .gitreview file (with contents similar to what this page calls the .gitremote) and then git remote -s worked fine. DavidBiesack (talk) 19:21, 18 April 2014 (UTC)Reply

An anonymous user changed the file name from .gitremote to .gitreview but left the name "git-remote" in the section title and text. There is a git-remote for configuring remote repositories, but I find its use in this context (for people new to git-review) confusing. Should these be changed to git-review? I'm new to git-review. DavidBiesack (talk) 12:34, 21 April 2014 (UTC)Reply

Hashbang line for git-review mangled on Windows

edit

Python 3.4.3 rc1/PIP mangled the hashbang line; it was looking like #!S:Python34python.exe for git-review-script.py As a result, I got a failed to create process. error.

The solution was to correct it to

#!S:\Python34\python.exe

Thanks PIP! Rillke (talk) 11:43, 14 February 2015 (UTC)Reply

Using GitHub for Windows

edit

GitHub for windows ships with a portable git version whose executables are also added to %PATH%. In case you have trouble to connect, use ssh -vvv username@gerrit.wikimedia.org -p 29418

  • I had to modify the C:\Users\<user>\AppData\Local\GitHub\PortableGit_<hash>\etc\ssh\ssh_config file extending it with:

<pre> Host gerrit.wikimedia.org StrictHostKeyChecking no UserKnownHostsFile=/dev/null IdentityFile=C:/Users/<username>/.ssh/id_rsa </pre> Of course C:/Users/<username>/.ssh/id_rsa must contain the private SSH key.

  • A successful connect will then look similar to:
Extended content
S:\myrepo>ssh -vvv rillke@gerrit.wikimedia.org -p 29418
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 1: Applying options for *
debug1: /etc/ssh/ssh_config line 10: Applying options for gerrit.wikimedia.org
debug2: ssh_connect: needpriv 0
debug1: Connecting to gerrit.wikimedia.org [208.80.154.81] port 29418.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "C:/Users/<username>/.ssh/id_rsa" as a RSA1 pub
lic key
debug1: identity file C:/Users/<username>/.ssh/id_rsa type 1
debug1: identity file C:/Users/<username>/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version GerritCodeReview_2.
8.1-4-ga1048ce (SSHD-CORE-0.9.0)
debug1: no match: GerritCodeReview_2.8.X-X-XXXXXXXX (SSHD-CORE-0.9.0)
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [gerrit.wikimedia.org]:29418
debug3: load_hostkeys: loading entries for host "[gerrit.wikimedia.org]:29418" f
rom file "/dev/null"
debug3: load_hostkeys: loaded 0 keys
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-
sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hel
lman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-n
istp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed2551
9-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com
,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,e
cdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour12
8,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,ae
s128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndae
l-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour12
8,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,ae
s128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndae
l-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,um
ac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hma
c-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@opens
sh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-1
28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh
.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,um
ac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hma
c-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@opens
sh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-1
28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh
.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cb
c
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cb
c
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_setup: setup hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug2: bits set: 519/1024
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA dc:e9:68:7b:99:1b:27:d0:f9:fd:ce:6a:2e:bf:92:e1
debug3: put_host_port: [208.80.154.81]:29418
debug3: put_host_port: [gerrit.wikimedia.org]:29418
debug3: load_hostkeys: loading entries for host "[gerrit.wikimedia.org]:29418" f
rom file "/dev/null"
debug3: load_hostkeys: loaded 0 keys
debug3: load_hostkeys: loading entries for host "[208.80.154.81]:29418" from fil
e "/dev/null"
debug3: load_hostkeys: loaded 0 keys
debug1: checking without port identifier
debug3: load_hostkeys: loading entries for host "gerrit.wikimedia.org" from file
 "/dev/null"
debug3: load_hostkeys: loaded 0 keys
debug3: load_hostkeys: loading entries for host "208.80.154.81" from file "/dev/
null"
debug3: load_hostkeys: loaded 0 keys
Warning: Permanently added '[gerrit.wikimedia.org]:29418,[208.80.154.81]:29418'
(RSA) to the list of known hosts.
debug2: bits set: 497/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: C:/Users/<username>/.ssh/id_rsa (0xa01f3xx),
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: C:/Users/<username>/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug2: input_userauth_pk_ok: fp XX:XX:XX:XX:XX:XX:3b:f8:a5:bc:b5:4f:97:ba:XX:XX

debug3: sign_and_send_pubkey: RSA XX:XX:XX:XX:XX:XX:3b:f8:a5:bc:b5:4f:97:ba:XX:XX
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key 'C:/Users/<username>/.ssh/id_rsa':
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to gerrit.wikimedia.org ([208.80.154.81]:29418).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
debug2: channel 0: rcvd ext data 281
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug3: channel 0: will not send data after close
debug2: channel 0: obuf_empty delayed efd 6/(281)

  ****    Welcome to Gerrit Code Review    ****

  Hi Rillke, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://rillke@gerrit.wikimedia.org:29418/REPOSITORY_NAME.git

debug2: channel 0: written 281 to efd 6
debug3: channel 0: will not send data after close
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
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 r130169 i3/0 o3/0 fd -1/-1 cc -1)

Connection to gerrit.wikimedia.org closed.
Transferred: sent 4400, received 2024 bytes, in 0.6 seconds
Bytes per second: sent 6811.1, received 3133.1
debug1: Exit status 127

Rillke (talk) 12:26, 14 February 2015 (UTC)Reply

WIndows installation woes

edit

There seem to be a few issues with the section on Windows installation.

1) The latest version is now 3.5.1 (not a major point).

2) The Python documentation gives several important differences between an installation for all users and one for a single user. Especially the default directory, which is not C:\Pythonxx in the latter case. May I suggest that someone who knows what they are doing (i.e. not me) updates the text to indicate which is preferable?

3) The pip command does not work as specified under git bash (at least in my case). There is no file called pip in the main Python directory. In the Scripts subdirectory there are 3 files: pip.exe, pip3.exe and pip3.5.exe but I don't know which one to use. Or should I be in a Windows command line interpreter here? Ptoye (talk) 11:11, 5 May 2016 (UTC)Reply

pip command does not work on Ubuntu stable

edit

On Ubuntu 24.04:

$ sudo pip install git-review
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

sudo apt-get install git-review works, although it installs a slightly older version than what's available via pip (2.3.1 rather than 2.4.0). Tgr (WMF) (talk) 21:34, 6 January 2025 (UTC)Reply

Return to "Gerrit/git-review" page.