How can we help you today? How can we help you today?

Connecting to self-hosted GIT server

Hello, 

I use a self-hosted GIT server with ssh publickey.

I can do anything with git commands in cmd window (stared from Flyway Desktop Community).

However, from the desktop the Version contol / fetch updates gives error:

info   |[App] git response (code 1):

error  |[App] git-fetch error:
{"shortMessage":"Running git fetch failed","longMessage":"Could not read from remote repository.
Raw git output:
user@ip: Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.","type":"E_GIT_FAIL"} 
{"stack":"Error: {\"shortMessage\":\"Running git fetch failed\",\"longMessage\":\"Could not read from remote repository.
Raw git output:
user@ip: Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights\\nand the repository exists.\",\"type\":\"E_GIT_FAIL\"}
   at toErrorWithMessage (file:///C:/Users/user/Flyway/flyway-desktop/resources/app.asar/out/electron/index.js:1:31995)
   at IpcMainImpl.<anonymous> (file:///C:/Users/user/Flyway/flyway-desktop/resources/app.asar/out/electron/index.js:187:29465)
   at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","message":"{\"shortMessage\":\"Running git fetch failed\",\"longMessage\":\"Could not read from remote repository.
Raw git output:
user@ip: Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.\",\"type\":\"E_GIT_FAIL\"}"}

How can I set the .gitconfig settings (git parameters) for using the Desktop's builtin GIT commands? 

Thanks, Peter 

cserna.peter
0

Comments

3 comments

  • Jon Kirkwood
    Official comment

    Hi cserna.peter 

    Thank you for reaching out on the Redgate forum regarding your Flyway self-hosted GIT inquiry.

    You need to point Flyway Desktop’s built-in Git to your SSH key, as it doesn’t always use the same config as your terminal.

    A quick fix is to edit your global .gitconfig (e.g. C:\Users\<you>\.gitconfig) and add:

    [core]
        sshCommand = "ssh -i C:/Users/<You>/.ssh/id_rsa" 

    Then restart Flyway Desktop.

    Also make sure your key is loaded with:

    ssh-add ~/.ssh/id_rsa

    and that git remote -v shows an SSH URL (not HTTPS).

    This usually fixes the Permission denied (publickey) error for the embedded Git client.

    Jon Kirkwood
  • cserna.peter

    Hello Jon, 

    Thank you for the clues! Unfortunately, I got the same error message after the changes.

    From CMD I can run e.g. git status (with the repo SSH URL) successfully and I do not need to enter my password. I started Flyway desktop from the same CMD and I got the same message if I clicked on the checkout button. (There are correct information on the uncommitted changes.) 

     

    cserna.peter
    0
  • Jon Kirkwood

    If git works fine from the command line but Flyway Desktop still shows Permission denied (publickey,password), it can mean that the Git client isn’t picking up your SSH setup. A few things you can try:

    1. Force the key at repo level
      Run this inside your repo folder:

      git config --local core.sshCommand "ssh -i C:/Users/<you>/.ssh/id_rsa -o IdentitiesOnly=yes" 
    2. Start Flyway Desktop with verbose SSH
      From the cmdline:

      set GIT_TRACE=1
      set GIT_SSH_COMMAND=ssh -vvv -i C:\Users\<you>\.ssh\id_rsa -o IdentitiesOnly=yes

      Then launch Flyway Desktop from the same CMD and try Fetch. The -vvv verbose level 3 log will show whether your key is being offered.

    3. Use an SSH config alias
      Create C:\Users\<you>\.ssh\config with:

      Host mygit
        HostName <ip-or-host>
        User <ssh-user>
        IdentityFile C:/Users/<you>/.ssh/id_rsa
        IdentitiesOnly yes

      Then set your remote to that alias:

      git remote set-url origin <ssh-user>@mygit:/path/to/repo.git
    4. Check your agent
      Make sure the key is loaded:

      ssh-add -l
      ssh -T <ssh-user>@<ip>

     

    Hopefully one of these steps helps you get some traction with your Flyway project pulling from your git server

    Jon Kirkwood
    0

Add comment

Please sign in to leave a comment.