Skip to content

Bug Report: 401 'Bad credentials' Error on First Sync Despite Correct Credentials #42

@deltaxsingh

Description

@deltaxsingh

Describe the bug
When setting up the plugin on a new Obsidian instance for the first time, it fails with a 401 Bad credentials error. This occurs even when the Personal Access Token (PAT), username, and repository details are all confirmed to be correct. Subsequent syncs work perfectly after applying a manual workaround.

To Reproduce

  1. Install the github-gitless-sync plugin on a fresh installation of Obsidian.
  2. Configure the plugin with a valid repository name, username, and a PAT with the correct permissions.
  3. Attempt the first sync.
  4. Observe the 401 error in the logs.

Expected behavior
The initial sync should complete successfully without any credential errors, cloning the remote vault content.

Actual behavior
The sync fails, and the following error is logged, indicating a credential issue:

{
  "timestamp": "2025-10-16T00:14:36.607Z",
  "level": "ERROR",
  "message": "Failed to get repo content",
  "additional_data": {
    "status": 401,
    "json": {
      "message": "Bad credentials",
      "documentation_url": "https://docs.github.com/rest",
      "status": "401"
    }
  }
}

Workaround and Additional Context
I was able to resolve the issue with the following steps:

  1. Manually copied my existing .obsidian configuration folder into the new vault.
  2. Reset the plugin's settings within Obsidian.
  3. Re-entered the same credentials (repository, username, PAT).

After performing this workaround, the sync functionality works as expected for all files except for the configuration folder, which seems to cause major issues when synced.

This initial hiccup seems to be the primary blocker for an otherwise killer plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions