What is the correct way to configure Qt Creator to use Git?

17,584

What I have always done:

  1. Install Windows (msys)git: select "only add git to PATH". This adds the Git\cmd directory to system/user-wide PATH, which is safe and very useful.

  2. Don't enter anything in Qt Creator for git. It's in PATH, so it "just works".

  3. Probably the most important due to the limited interactivity between git and Qt Creator: make sure your remote host is aware of your SSH key (so you don't need to enter a password, I don't think Qt Creator can handle that, and I believe this is what's going wrong in your case), and make sure your SSH config file contains the IP of the host as trusted (you can check this by running a git clone or git push from the commandline (not "git bash", just a plain cmd. This ensures your environment is similar to what Qt Creator sees.

I stress that nothing else needs setting up, so if you did, you might have broken something that should work with the above steps.

Share:
17,584
vrios
Author by

vrios

Updated on June 05, 2022

Comments

  • vrios
    vrios almost 2 years

    I'm trying to use Git for Windows together with QT Creator 2.8, and failing miserably. I created a repository on bitbucket, following the bitbucket 101 tutorial and everything runs smoothly when I use Git Bash, or even Git GUI. The PATH variable is set properly, everything works outside Qt. However, when trying to configure Qt Creator, I cannot access the remote repository. The error given is:

    16:25 Executing in C:\Users(...): C:\Program Files (x86)\Git\cmd\git.exe pull The command 'C:\Program Files (x86)\Git\cmd\git.exe' did not respond within the timeout limit (60000 ms).

    Almost everything I have found tells me to configure PATH, and that should cause everything to run ok, but my PATH is set correctly (I can type ssh from the windows command prompt and it works). The Qt Creator documentation (http://qt-project.org/doc/qtcreator-2.8/creator-version-control.html) tells me that I should

    "Select Tools > Options > Version Control > Git. Select the Environment Variables and the Set "HOME" environment variable check boxes."

    The set "HOME"(...) box is checked, but there is no "Environment Variables" box. The SSH prompt command is set to C:\Program Files (x86)\Git\bin\ssh.exe, but I have tried setting it to almost every program on \git\bin and git\cmdwithout success. I have found answers here that tell me to use some version of win-ssh-askpass or win-ssh-agent, but those either require Cygwin or come from dubious sources.

  • vrios
    vrios over 10 years
    I uninstalled QT and Git to make sure I undid anything I might have done wrong, and it indeed just works. I found no way of using a passphrase for my public key with Qt, but now i can use git normally with QTCreator. Thanks!
  • rubenvb
    rubenvb over 10 years
    @vrios yes, that's a limitation. Have you tried just typing the password in the "version control" output window when you should be expected to (i.e. after selecting "git push" from the menus or something). Glad I could help.
  • vrios
    vrios over 10 years
    I have tried that, yes, but Qt Creator does not accept typing on the output panels
  • rubenvb
    rubenvb over 10 years
    @vrios OK, I suggested that because a long time ago I types the input to a program I ran through Qt Creator into the application output pane. Must've misremembered :)
  • Jonathan Root
    Jonathan Root almost 10 years
    Possible Update: Since "git" didn't work as PATH in the Qt5 settings, I entered the entire path to the git.exe (stackoverflow.com/questions/1452964/…). But I also had installed the git-credential-winstore (for path error: stackoverflow.com/questions/13107833/…).