Skip to content

Git backup over HTTPS fails if username/password contains special characters #1709

Description

@alubbock

Describe the bug
Git backup fails if using HTTPS connection with basic auth if the username or password contains special characters, including #, /, & and others which are reserved in URLs.

To Reproduce
In Admin -> Storage -> Git, add a repo (e.g. on Github) and use HTTP basic auth (not SSH). Use a password on the git remote containing a special character.

Expected behavior
Git backup completes successfully.

Docker Logs

URL replaced with representative example.

wikijs_1  | 2020-04-12T20:22:58.544009323Z 2020-04-12T20:22:58.543Z [MASTER] info: (STORAGE/GIT) Initializing...
wikijs_1  | 2020-04-12T20:22:58.544687550Z 2020-04-12T20:22:58.544Z [MASTER] info: (STORAGE/GIT) Checking repository state...
wikijs_1  | 2020-04-12T20:22:58.568330568Z 2020-04-12T20:22:58.568Z [MASTER] info: (STORAGE/GIT) Listing existing remotes...
wikijs_1  | 2020-04-12T20:22:58.577111486Z 2020-04-12T20:22:58.576Z [MASTER] info: (STORAGE/GIT) Purging existing remotes...
wikijs_1  | 2020-04-12T20:22:58.587138257Z 2020-04-12T20:22:58.586Z [MASTER] info: (STORAGE/GIT) Setting SSL Verification config...
wikijs_1  | 2020-04-12T20:22:58.596042587Z 2020-04-12T20:22:58.595Z [MASTER] info: (STORAGE/GIT) Adding origin remote via HTTP/S...
wikijs_1  | 2020-04-12T20:22:58.604767385Z 2020-04-12T20:22:58.604Z [MASTER] info: (STORAGE/GIT) Fetch updates from remote...
wikijs_1  | 2020-04-12T20:22:58.627726256Z fatal: unable to access 'https://example.com/user/wiki.git': Could not resolve host: user
wikijs_1  | 2020-04-12T20:22:58.627773027Z error: Could not fetch origin

The message Could not resolve host: user appears because the URL is parsed incorrectly by git due to the presence of one or more special characters in the password.

Host Info (please complete the following information):

  • Environment: Docker
  • Wiki.js version: 2.2.51
  • Database engine: Postgres 12

Additional context
Can be fixed by replacing special characters in the username and password, as described in this blog post.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions