techservicesillinois / awscli-login

​awscli-login is an AWS CLI plugin that manages retrieving and rotating Amazon STS temporary credentials using SAML ECP for authentication with optional support for Duo.
https://pypi.org/project/awscli-login/
Other
53 stars 25 forks source link

aws login doesn't work in gitshell #2

Closed cmaturi closed 3 years ago

cmaturi commented 6 years ago

aws login hangs out in git shell

cmaturi@CITES-P10R37289 ~/code (master) $ vi ~/.aws/credentials

cmaturi@CITES-P10R37289 ~/code (master) $ aws login

ddriddle commented 5 years ago

@cmaturi I believe this issue is related to this issue on Stack Overflow:

Python not working in the command line of git bash https://stackoverflow.com/questions/32597209/python-not-working-in-the-command-line-of-git-bash

It seems that the Windows version of Python does not work with Git shell by default. Try running python in Git shell and see if you have the same problem as described in the article above.

If you do, see if the following workaround allows you to run awscli-login from Git shell:

$ winpty aws login 
zdc217 commented 3 years ago

@cmaturi I believe this issue is related to this issue on Stack Overflow:

Python not working in the command line of git bash https://stackoverflow.com/questions/32597209/python-not-working-in-the-command-line-of-git-bash

It seems that the Windows version of Python does not work with Git shell by default. Try running python in Git shell and see if you have the same problem as described in the article above.

If you do, see if the following workaround allows you to run awscli-login from Git shell:

$ winpty aws login 

The error message I get in git bash complains about my python install location:

bash: /c/Users/zdc/AppData/Roaming/Python/Python38/Scripts/aws: c:\program: bad interpreter: No such file or directory

winpty approach does not work on my machine. For me the issue appeared to be that my default installation of python was at a path that had a space in it: c:\program files\python38\python.exe. To work around this I moved my python install to C:\python38 and updated the shebang in my aws script.

Another workaround that does not involve changing the aws script was running

$ python $(which aws) login

You can also add an alias:

alias aws='python $(which aws)'

and then use aws login normally

tzturner commented 3 years ago

On my machine, git bash works perfectly. Note that the shebang has no spaces in the path.

$ head `which aws`
#!c:\python39\python.exe
# Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.

# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at

#     http://aws.amazon.com/apache2.0/

# or in the "license" file accompanying this file. This file is