cli: "cf login " interactive password prompt fails on cygwin

password should be interactively prompted for when -p is omitted, regardless of whether -u was specified.

At least, it should be more user-friendly to remind users that if they prefer interactive login (to avoid having password recorded in their shell history) then they should omit both password and login, otherwise the password won’t be prompted and auth will fail:

$ cf login -a https://api.run.pivotal.io -u user@domain.com -o myorg
API endpoint: https://api.run.pivotal.io
Authenticating...
Credentials were rejected, please try again.
Authenticating...
Credentials were rejected, please try again.
Authenticating...
Credentials were rejected, please try again.
FAILED
Unable to authenticate.

API endpoint: https://api.run.pivotal.io (API version: 2.4.0)
Not logged in. Use 'cf.exe login' to log in.

$ cf --version
C:\Program Files (x86)\CloudFoundry\cf.exe version 6.1.2-6a013ca

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 2
  • Comments: 40 (8 by maintainers)

Most upvoted comments

I haven’t tested this in Cygwin specifically, but the same symptoms exists when using the cli from within a git bash shell on Windows. Adding the following alias to your .bashrc file seems to work:

alias cf=‘winpty cf’

or just run this from your shell: echo alias cf=“‘winpty cf’” >> ~/.bashrc

I hope this helps.

For windows users, a bash shell with productive features (searching in the history, clipboard cut/paste, completion on file path, alias to set CF_HOME to switch among CF instances…), makes a real difference in term of productivity when using the CF CLI.

I currently work around this issue using cf auth login pwd instead of cf login.

Hi All,

Please follow these instructions.

Use the below command to verify your credentials. cf login -a https://api.example.com -u username@example.com -p Password 2. use login -a $url -u xxx@abc.com -p xxxxx instead of cf login -a $url command if you are using this in a script.

Thanks, Arun

This was a little tricky to find. Hopefully anyone having this issue that wants to just be able to git bash finds this comment from March 2017:

I haven’t tested this in Cygwin specifically, but the same symptoms exists when using the cli from within a git bash shell on Windows. Adding the following alias to your .bashrc file seems to work:

alias cf=‘winpty cf’

or just run this from your shell: echo alias cf=“‘winpty cf’” >> ~/.bashrc

I hope this helps.

(This is what I posted in my group’s chat: 2) git bash will not work unless you go through some hoops (you can put your password in plain text on the same line with the -p flag (which is generally a BAD IDEA), use git cmd, run git bash from Git/bin, you can sign in under another service and go back to using git bash, OR you can actually fix the problem by setting an alias in your Git/etc/bash.bashrc with “alias cf=‘winpty cf’” according to a comment in the bottom of this cf issue page: )

I was facing the same issue, fixed it by setting proxies , by running following command on windows SET HTTP_PROXY=http://proxy.yourorganisation.com:port SET HTTPS_PROXY=https://proxy.yourorganisation.com:port

PS: the issue seems to be the same as https://github.com/golang/go/issues/13088.

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/121914309

The labels on this github issue will be updated when the story is started.

Thanks everbody for speaking up!

I have created an exploratory story to find out what’s involved (link to the story is in the next comment).

We currently do platform specific stuff to make the interactivity work, and the team’s initial concern was that golang may not support what we need to implement this. This will be investigated as part of this story.

Cheers, Dies Koper CF CLI PM

another +1 for cygwin ( Git Bash actually )

+1 for implementing Cygwin support or at least providing a workaround with the current “bug”

Another +1 here. As for the story, after sign-up, I get: “You are not allowed to view the requested page.”

+1 on this issue. Is cywgin still unsupported? Also, the tracker link is broken - was the story deleted?