Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infisical CLI: Path incorrect with Git bash / windows #1595

Open
Khaaz opened this issue Mar 18, 2024 · 1 comment
Open

infisical CLI: Path incorrect with Git bash / windows #1595

Khaaz opened this issue Mar 18, 2024 · 1 comment

Comments

@Khaaz
Copy link

Khaaz commented Mar 18, 2024

Describe the bug

Discussed in this thread on slack: https://infisical-users.slack.com/archives/C04BSBMQAQ7/p1709161491917939

I am on windows, I use cmder which use git bash it seems.
I can reproduce this issue with git bash directly, but I can't reproduce it on WSL for instance.

In the terminal, I have no issue at all, it works perfectly. However when I put the same command in a SH script it doesn't.
I am correctly logged (I logged in with infisical login).

After a lot of debugging, here what I found:

When I use the command like this:

infisical export --path="/account" --env="dev"

It in fact replaces the / by the path to the executable C:/Program Files/Git. So it tries to request a secret with the path: C:/Program Files/Git/account

I have to "escape" the / with a second / like: //

infisical export --path="//account" --env="dev"

And that actually works

To Reproduce

Expected behavior

It should behave the same way as it does on UNIX.

Screenshots

The script ran through cmder and git bash, with the command being exactly:

infisical export --path="/account" --env="dev"

image
image

Platform you are having the issue on:

WIndows, with git bash / cmder.

Additional context

My current workaround is:

#!/usr/bin/env sh

PACKAGE_ROOT=$PWD
PACKAGE_NAME=$(basename "$PACKAGE_ROOT")

ENV="dev"
PREFIX=""

case $(uname | tr '[:upper:]' '[:lower:]') in
  msys*)
    PREFIX=//
    ;;
  *)
    PREFIX=/
    ;;
esac

infisical export --path="$PREFIX$PACKAGE_NAME" --env=$ENV

Although it's clearly not optimum.

@akhilmhdh
Copy link
Member

Hey @Khaaz i don't think this is an Infisical specific issue rather something with the tool and platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants