loading...

re: Custom git credential helper VIEW POST

FULL DISCUSSION
 

hi,
I've just tried to execute slightly modified code, but I always get error "fatal: Authentication failed for mydomain/git/myGitRepo.git/".

My environment:

OS version: Microsoft Windows 8.1 Pro
>git --version
git version 2.20.1.windows.1
>python --version
Python 3.8.2

Problem description

In the place of following

    if arguments.operation == "get":
          creds = credentials.get()
          print("username={0}".format(creds.get("username")))
          print("password={0}".format(creds.get("password")))

I've just hardcoded username and password which works when credential.helper is unset :

    if arguments.operation == "get":
        #print("protocol=https")    <-- even try with uncommented this line and the next one, but unsuccessfully
        #print("host=mydomain")
        print("username=myUsername")
        print("password=myPassword")

I've also tried another form of setting credential.helper (it is possible to check which is domain by using sys.stdin.read(), but for this example it is not so important ) :

    git config --global credential.helper abs/path/to/my/pyth/script.py

I read git credential documentation thoroughly, take a look on 5-6 different examples on the net (good example is this link ), but could not get this simple case to work.

Code of Conduct Report abuse