Pushing a new bugfix to gerrit

  • I'm trying to push new bugfix to the dev branch. I have setup the keys correctly as I can see the tests for gerrit.

    I have the small patch in the local dev branch (commit 38b4ff998f5ccab91c48b399b75963ebab031ef2 (HEAD -> dev))

    When I try to git gpush the commit I get this message:

    C:\prg\QT\qt5\qtbase>git gpush
    Enter passphrase for key 'C:\sec\qt\gerrit\qt_openssh_key_priv':
    Pushing 1 Change(s) for dev to 'gerrit':
      I318207c45 (Initial tray notification icon visibility)  [NEW]
    FATAL ERROR: Network error: Connection timed out
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.

    The test ssh codereview.qt-project.org gerrit stream-events passes. The Gerrit raw events are show at console.

    Could someone steer me in the right direction?

  • Lifetime Qt Champion

    @tukan said in Pushing a new bugfix to gerrit:

    Could someone steer me in the right direction?

    See https://wiki.qt.io/Gerrit_Introduction - your push command is wrong.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you get the same message if you use the classic push version ?

  • Hi @Christian-Ehrlicher,

    I have read this part of the wiki too. Why is the push command wrong? I'm using git gpush excatly as shown in the tutorial you have posted link to. I have used the gpush as it was recommended.

    That would be this part of the tutorial:

    $ git gpush
    [same output as above]

    Hi @SGaist,

    I have tried to debug it again today.

    The git push gerrit HEAD:refs/for/dev does not work either:

    C:\prg\QT\qt5\qtbase>git push gerrit HEAD:refs/for/dev
    FATAL ERROR: Network error: Connection timed out
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.

    I did run the init-scripts, but wanted to make sure the remote gerrit repo exists (it does):

    C:\prg\QT\qt5\qtbase>git remote add gerrit ssh://codereview.qt-project.org/qt/qtbase
    fatal: remote gerrit already exists.

    I wanted to make sure with ls-remote:

    C:\prg\QT\qt5\qtbase>git ls-remote gerrit
    FATAL ERROR: Network error: Connection timed out
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.

    But it returns its url:

    C:\prg\QT\qt5\qtbase>git ls-remote --get-url gerrit
    I don't understand, why I see the url, but can't connect to the remote repository.
    Next I have tried to connect to the `ssh` to see if it will connect, to me it looks correct
    C:\prg\QT\qt5\qtbase>ssh ssh://tukan@codereview.qt-project.org
    Enter passphrase for key 'C:\sec\qt\gerrit\qt_openssh_key_priv':
      ****    Welcome to Gerrit Code Review    ****
      Hi tukan, you have successfully connected over SSH.
      Unfortunately, interactive shells are disabled.
      To clone a hosted Git repository, use:
      git clone ssh://tukan@codereview.qt-project.org:29418/REPOSITORY_NAME.git
    Connection to codereview.qt-project.org closed by remote host.
    Connection to codereview.qt-project.org closed.

    I tried to play around with the git's http timeout configuration (that did not help either):

    lowSpeedLimit = 1000
    lowSpeedTime = 20

    I did check the repository if there is anything fishy, but it looks fine to me (did rebase to have the newest changes there):

    git log --summary
    commit 35199562a8968dc1c78a9b7ac3f5975f0e2ac199 (HEAD -> dev)
    Author: Patrik Svestka <scramble>
    Date:   Tue Jun 2 10:55:55 2020 +0200
    <commit message>
        Change-Id: I318207c4551004c9fac3b487cbeca9a97528e3d2
    commit 7ede57f937f988780d6751da34c941447ec6fd32 (origin/dev, origin/HEAD)
    Author: Assam Boudjelthia <scramble>
    Date:   Fri May 15 11:09:20 2020 +0300
    <commit message>
        Pick-to: 5.15
        Task-number: QTCREATORBUG-23768
        Change-Id: I76088358dc31be45adb766bed29e2c9d889a8f09
        Reviewed-by: hjk <scramble>
        Reviewed-by: Alessandro Portale <scramble>

    Thank you for helping me.

  • Lifetime Qt Champion

    How did you set up your Qt repo? Looks like your push url is wrong. Please exactly follow the instruction at the page I gave you.

  • Lifetime Qt Champion

    Can you show the result of git remote -v ?

  • Lifetime Qt Champion

    Hi @tukan,


    What happens if you change the remote URL to ssh://tukan@codereview.qt-project.org:29418/qt/qbase.git as suggested?

  • Thank you @Christian-Ehrlicher, @SGaist, @aha_1980 for assistence. After some fiddling around I managed to push the commit!

    C:\prg\QT\qt5\qtbase>git push gerrit HEAD:refs/for/dev
    Enumerating objects: 13, done.
    Counting objects: 100% (13/13), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (7/7), done.
    Writing objects: 100% (7/7), 845 bytes | 845.00 KiB/s, done.
    Total 7 (delta 6), reused 0 (delta 0), pack-reused 0
    remote: Resolving deltas: 100% (6/6)
    remote: Processing changes: refs: 1, new: 1, done
    remote: SUCCESS
    remote:   https://codereview.qt-project.org/c/qt/qtbase/+/302953 Initial tray notification icon visibility [NEW]
    To ssh://codereview.qt-project.org:29418/qt/qtbase.git
     * [new branch]            HEAD -> refs/for/dev

    I don't know why the remote was wrong. I did not play around with it, till you pointed out the issue.

    I had an issue with type on my side when changing the remote. I'm writing the details here so it can help someone in the future.

    I did git remote set-url gerrit ssh://tukan@codereview.qt-project.org:29418/qt/qbase.git (notice the typo qbase not qtbase).

    The original git remote -v:
    C:\prg\QT\qt5\qtbase>git remote -v
    gerrit ssh://codereview.qt-project.org/qt/qtbase.git (fetch)
    gerrit ssh://codereview.qt-project.org/qt/qtbase.git (push)
    origin git://code.qt.io/qt/qtbase.git (fetch)
    origin git://code.qt.io/qt/qtbase.git (push)

    now changed to as @aha_1980 suggested:
    C:\prg\QT\qt5\qtbase>git remote -v
    gerrit ssh://tukan@codereview.qt-project.org:29418/qt/qbase.git (fetch)
    gerrit ssh://tukan@codereview.qt-project.org:29418/qt/qbase.git (push)
    origin git://code.qt.io/qt/qtbase.git (fetch)
    origin git://code.qt.io/qt/qtbase.git (push)

    I have setup the git to use the plink (GIT_SSH=C:\<path>\PLINK.EXE) & pageant from putty suite so it won't ask me for passwd.

    The error message was now different:

    C:\prg\QT\qt5\qtbase>git push gerrit HEAD:refs/for/dev
    fatal: project qt/qbase not found
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    Next I noticed the typo:
    I did change it to correct gerrit repository path:
    git remote set-url gerrit ssh://tukan@codereview.qt-project.org:29418/qt/qtbase.git and it worked!

    @Christian-Ehrlicher I did it as written in the wiki, clone and run the init-script on qt5. I did double check today the guide:

    Set up a Gerrit account

    1) Tweak your SSH config as instructed here [DONE]
    2) Use the recommended Git settings, defined here [DONE]
    3) Get the source code of the projects you want to contribute to [DONE]
    4) executed init-repository for the qt5 repository [DONE]

    the .ssh config:

    Host codereview.qt-project.org
        Hostname codereview.qt-project.org
        Port 29418
        # Use your Gerrit username, not email or your username on your own machine.
        # You can view this from Settings in gerrit when logged in.
        User tukan
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/id_rsa

    For future reference:

    I started with the guide QT Contribution Guidelines. From there I followed a link the Building. Then made the change and when it did not work started to read all the docs around gerrit.

    The command used for getting the source code:

    First clone the top-level Qt 5 git repository:

    $ git clone git://code.qt.io/qt/qt5.git

    Next I checkout the 5.15 & ran the init-repository

    $ cd qt5
    $ git checkout 5.15
    $ perl init-repository

Log in to reply