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

GIT_TERMINAL_PROMPT=0 git 2.3 feature #161

Closed
bruno- opened this issue Feb 8, 2015 · 8 comments
Closed

GIT_TERMINAL_PROMPT=0 git 2.3 feature #161

bruno- opened this issue Feb 8, 2015 · 8 comments

Comments

@bruno-
Copy link

bruno- commented Feb 8, 2015

Hi,
thank you for making and maintaining this great plugin.

A couple days ago new git version 2.3 was released. Among new features is also GIT_TERMINAL_PROMPT environment variable. When it is set to 0 git will never prompt for user credentials.
You can learn more about it in man git (after updating to git 2.3) or in this blog post on github.

Just as an example, here's how it works:

  • git clone https://github.com/some/non-existing-repo - will prompt for a username & password
  • GIT_TERMINAL_PROMPT=0 git clone https://github.com/some/non-existing-repo - will fail without prompting for username & password
  • GIT_TERMINAL_PROMPT=0 git submodule add https://github.com/chaconinc/DbConnector - also fails withot prompting for username & pass

I think this addition could potentially be valuable to vim-plug in the following places:

  • when doing git clone
  • when doing git submodule update
  • when doing git fetch (just in case a user manually changed git remote)

I was thinking of opening a pull request that prepends git commands with export GIT_TERMINAL_PROMPT=0. Example line 926:

(export GIT_TERMINAL_PROMPT=0; git fetch --progress 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only origin/%s 2>&1 && git submodule update --init --recursive 2>&1)

I did something similar for tmux plugin manager.

Related issues are #109, #56.

What do you think about this?

@junegunn
Copy link
Owner

junegunn commented Feb 8, 2015

Thanks for the info! I wish this was available in the older versions of git. 😞
I'll definitely consider applying this new option and (finally) removing the annoying git:: from the url, but since we can't expect the majority of the users of vim-plug to upgrade their git to 2.3 anytime soon, I'll leave this issue open for a while if you don't mind. We also have to check how we can apply this on Windows.

@bruno-
Copy link
Author

bruno- commented Feb 8, 2015

Hi @junegunn,
no problem about leaving this open.

About the git:: - of course that should be left in the source for backwards compatibility.

I don't think these 2 things interfere though. In fact, it might be good to have both of them present for the case when a user wants to install git plugin from a host other than github. Example url: https://bitbucket.org/foo/bar.git. From what I can see, vim-plug will not use git:: credentials for that url? In this case, having GIT_TERMINAL_PROMPT=0 might be useful if a user is on git 2.3.

The above example is, of course theoretical because why would anyone want to use anything except github lol.

@junegunn
Copy link
Owner

junegunn commented Feb 8, 2015

Thanks. You're absolutely right. One concern I have about it is as I mentioned previously, how we can put it on windows. I currently don't have a Windows development environment and have no sufficient knowledge on Windows CLI, so I'm not sure how we should do it there. And @starcraftman is working on Python version of the installer, so I'd like to wait until it's stable and merged.

@bruno-
Copy link
Author

bruno- commented Feb 8, 2015

Agreed.
I'm also not familiar with windows environment so yea, let's wait.

@arp242
Copy link

arp242 commented Feb 11, 2015

I just noticed that when you have:

Plug 'this-very-obviously-doesnt-exist-at-all/yikes'

or:

Plug 'junegunn/this-very-obviously-doesnt-exist-at-all'

You get the rather confusing error:

x yikes                                                              
    Cloning into '/home/martin/.vim/plugged/yikes'...                
    remote: Invalid username or password.                            
    fatal: Authentication failed for 'https://git::@github.com/this-very-obviously-doesnt-exist-at-all/yikes.git/'

I wanted to report an issue for this, but maybe this is fixed with this new git feature?

(Odiously no one would type this, but I made a silly typo, and was a bit confused for a minute)

@starcraftman
Copy link
Contributor

@bruno- Please note, export is not valid on Windows cmd.exe (like many other things, sadly). Doing as you suggest would cause problems. If you do make a pull request/fork, ensure you switch on the is_win to prevent any regressions.

@junegunn Sorry for the delay on my fork. I've been a bit busy the last week. Tests are now passing. The only major issue is getting line-by-line buffer updating you do in ruby on linux. Subprocess module doesn't allow easy intercept as with PlugStream & IO.popen. Annoyingly, only solution might involve even more threads? Will investigate.

@junegunn
Copy link
Owner

@Carpetsmoker Yes, it's a known problem and we haven't managed to find a better way to handle non-existing repository. vim-plug injects git:: to avoid username/password prompt during clone/pull. See this link for the details.

@starcraftman No problem. Take your time. I'm following your repository and saw the issue which is a bit disappointing. I've wanted to help but been busy with other stuff and I don't have enough experience with Python. I'll look into it when I get some time.

@junegunn
Copy link
Owner

Closing with #168.

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

No branches or pull requests

4 participants