GitJournal / GitJournal

Mobile first Note Taking integrated with Git
https://gitjournal.io
GNU Affero General Public License v3.0
3.38k stars 224 forks source link

Sync Error Invalid Credentials #520

Closed MirisWisdom closed 2 years ago

MirisWisdom commented 3 years ago

Environment

App version: 1.77.4+2602 Device information:

Description

Expected behavior:

GitJournal synchronises the data over SSH.

Current behavior:

When trying to synchronise the data to the remote SSH server, the following error keeps occurring: Sync Error Invalid Credentials. I can confirm that the SSH keys are authorised on the server:

Jul  6 01:04:38 mercury sshd[6310]: Connection from 10.8.1.5 port 57416 on 10.8.1.8 port 22 rdomain ""
Jul  6 01:04:38 mercury sshd[6310]: Accepted key RSA SHA256:b2FfIEnAjs4GZ0A3t9fqLpW6lFzFMSXibb/fb1TVlmY found at /home/mirai/.ssh/authorized_keys:1
Jul  6 01:04:38 mercury sshd[6310]: Postponed publickey for mirai from 10.8.1.5 port 57416 ssh2 [preauth]
Jul  6 01:04:38 mercury sshd[6310]: Connection closed by authenticating user mirai 10.8.1.5 port 57416 [preauth]

I've attempted a synchronsiation across three different servers and the same issue occurs. Currently using GitJournal 1.77.4+2602, and the issue happened once GitJournal begun starting up after #512 was fixed.

Steps to reproduce

  1. Tap GitJournal
  2. Synchronise to the SSH server
  3. Misery

Others

01:04:38 Failed to Sync GitException: Invalid Credentials

[
    {
        uri: package:dart_git/utils/result.dart, line: 24, member: Result.throwOnError, isCore: false, library: package:dart_git/utils/result.dart, location: package:dart_git/utils/result.dart 24, package: dart_git
    }, 
    {
        uri: package:dart_git/utils/result.dart, line: 54, member: ResultFuture.throwOnError, isCore: false, library: package:dart_git/utils/result.dart, location: package:dart_git/utils/result.dart 54, package: dart_git
    }, 
    {
        uri: package:gitjournal/repository.dart, line: 206, member: GitJournalRepo.syncNotes, isCore: false, library: package:gitjournal/repository.dart, location: package:gitjournal/repository.dart 206, package: gitjournal
    },
    {
        uri: package:gitjournal/widgets/sync_button.dart, line: 101, member: _SyncButtonState._syncRepo, isCore: false, library: package:gitjournal/widgets/sync_button.dart, location: package:gitjournal/widgets/sync_button.dart 101, package: gitjournal
    }
]
vHanda commented 2 years ago

I just released 1.79, could you please let me know if it still occurs?

Not-a-web-Developer commented 2 years ago

I'm not OP and I'm not on iOS (I have an Android 11 device), but I have the same issue (app version is 1.79.1+2747)

chumaltd commented 2 years ago

@vHanda Hi, I got this too on v1.80.3+2979 / Android 11. GitException: Invalid Credentials raised at git_bindings/git_bindings.dart 39.

On my server side, I have the log as bellows:

Connection closed by authenticating user git 1x.2x.xx.4 port 52480 [preauth]

It says "preauth", so do I fail at host verification?

I just accidentally set repo saving option to external storage, and existing key blows up. After new keys deployment, I hit this situation.

dcousens commented 2 years ago

Happening for me on 1.81.1+3088, can't re-key after testing a work-around for https://github.com/GitJournal/GitJournal/issues/559

vHanda commented 2 years ago

Happening for me on 1.81.1+3088, can't re-key after testing a work-around for #559

Would you mind trying the latest 'dev' build? You can access it via 'fdroid' - https://gitjournal.io/fdroid_how_to/

vHanda commented 2 years ago

Fixed with 1.82.3. It's still pending review.

MirisWisdom commented 2 years ago

Pardon the slow response -- haven't had a chance to play around with GitJournal recently.

Issue is still occurring on 1.82.4+3356:

Step 1 Step 2 Step 3 Step 4
image image image image

I've used the exact same keys, repository and server on Working Copy without any problems at all. Let me know if you need any details or if there's anything I can do to help.

Debug Log

{
    "t": 1643411950467,
    "l": "d",
    "msg": "Event.DrawerSetupGitHost"
}
{
    "t": 1643411951415,
    "l": "d",
    "msg": "githostsetup_button_click Custom"
}
{
    "t": 1643411951416,
    "l": "d",
    "msg": "Event.GitHostSetupButtonClick",
    "p": {
        "text": "Custom",
        "icon_url": ""
    }
}
{
    "t": 1643411962200,
    "l": "d",
    "msg": "githostsetup_button_click Next"
}
{
    "t": 1643411962200,
    "l": "d",
    "msg": "Event.GitHostSetupButtonClick",
    "p": {
        "text": "Next",
        "icon_url": ""
    }
}
{
    "t": 1643411963733,
    "l": "d",
    "msg": "githostsetup_button_click Provide Custom SSH Keys"
}
{
    "t": 1643411963734,
    "l": "d",
    "msg": "Event.GitHostSetupButtonClick",
    "p": {
        "text": "Provide Custom SSH Keys",
        "icon_url": ""
    }
}
{
    "t": 1643411973281,
    "l": "d",
    "msg": "githostsetup_button_click Next"
}
{
    "t": 1643411973282,
    "l": "d",
    "msg": "Event.GitHostSetupButtonClick",
    "p": {
        "text": "Next",
        "icon_url": ""
    }
}
{
    "t": 1643411973282,
    "l": "i",
    "msg": "RepoPath: /var/mobile/Containers/Data/Application/1B117331-BD08-41F0-A3A0-9526EA5B37FC/Documents/repo_2"
}
{
    "t": 1643411986480,
    "l": "e",
    "msg": "Failed to clone",
    "ex": "GitException: Invalid Credentials",
    "stack": [
        {
            "uri": "package:git_bindings/git_bindings.dart",
            "line": 39,
            "member": "GitRepo.fetch",
            "isCore": false,
            "library": "package:git_bindings/git_bindings.dart",
            "location": "package:git_bindings/git_bindings.dart 39",
            "package": "git_bindings"
        },
        {
            "uri": "package:gitjournal/setup/clone_libgit2.dart",
            "line": 55,
            "member": "_fetch",
            "isCore": false,
            "library": "package:gitjournal/setup/clone_libgit2.dart",
            "location": "package:gitjournal/setup/clone_libgit2.dart 55",
            "package": "gitjournal"
        },
        {
            "uri": "package:gitjournal/setup/clone.dart",
            "line": 71,
            "member": "cloneRemotePluggable",
            "isCore": false,
            "library": "package:gitjournal/setup/clone.dart",
            "location": "package:gitjournal/setup/clone.dart 71",
            "package": "gitjournal"
        },
        {
            "uri": "package:dart_git/utils/result.dart",
            "line": 62,
            "member": "catchAll",
            "isCore": false,
            "library": "package:dart_git/utils/result.dart",
            "location": "package:dart_git/utils/result.dart 62",
            "package": "dart_git"
        },
        {
            "uri": "package:gitjournal/setup/screens.dart",
            "line": 556,
            "member": "GitHostSetupScreenState._startGitClone",
            "isCore": false,
            "library": "package:gitjournal/setup/screens.dart",
            "location": "package:gitjournal/setup/screens.dart 556",
            "package": "gitjournal"
        }
    ]
}
{
    "t": 1643411986489,
    "l": "d",
    "msg": "Event.GitHostSetupGitCloneError",
    "p": {
        "error": "GitException: Invalid Credentials"
    }
}
{
    "t": 1643411994386,
    "l": "d",
    "msg": "Event.DrawerSettings"
}
philler3000 commented 1 year ago

On the first screen write ssh://git@... with leading ssh:// solved it for me