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

"sh: git: command not found" (Windows) #738

Open
neil-s opened this issue Jun 26, 2016 · 5 comments
Open

"sh: git: command not found" (Windows) #738

neil-s opened this issue Jun 26, 2016 · 5 comments

Comments

@neil-s
Copy link

neil-s commented Jun 26, 2016

I installed Cmder (which includes Git for windows), followed the instructions for the correct paths on Windows, and added 3 plugins to my _vimrc. When I try to run :PluginInstall, it complains that it can't install any of them because it can't find git.

[2016-06-26 01:12:27] 
[2016-06-26 01:12:27] Plugin VundleVim/Vundle.vim
[2016-06-26 01:12:27] $ git clone --recursive 'https://github.com/VundleVim/Vundle.vim.git' 'C:UsersNeil/vimfiles/bundle/Vundle.vim'
[2016-06-26 01:12:27] > sh: git: command not found
[2016-06-26 01:12:27] > 
[2016-06-26 01:12:28] 
[2016-06-26 01:12:28] Plugin scrooloose/nerdtree
[2016-06-26 01:12:28] $ git clone --recursive 'https://github.com/scrooloose/nerdtree.git' 'C:UsersNeil/vimfiles/bundle/nerdtree'
[2016-06-26 01:12:28] > sh: git: command not found
[2016-06-26 01:12:28] > 
[2016-06-26 01:12:29] 
[2016-06-26 01:12:29] Plugin scrooloose/nerdcommenter
[2016-06-26 01:12:29] $ git clone --recursive 'https://github.com/scrooloose/nerdcommenter.git' 'C:UsersNeil/vimfiles/bundle/nerdcommenter'
[2016-06-26 01:12:29] > sh: git: command not found
[2016-06-26 01:12:29] > 
[2016-06-26 01:12:30] 
[2016-06-26 01:12:30] Helptags:
[2016-06-26 01:12:30] Helptags: 0 plugins processed
[2016-06-26 01:21:52] 
[2016-06-26 01:21:52] Plugin VundleVim/Vundle.vim
[2016-06-26 01:21:52] $ git clone --recursive 'https://github.com/VundleVim/Vundle.vim.git' 'C:UsersNeil/vimfiles/bundle/Vundle.vim'
[2016-06-26 01:21:52] > sh: git: command not found
[2016-06-26 01:21:52] > 
[2016-06-26 01:21:53] 
[2016-06-26 01:21:53] Plugin scrooloose/nerdtree
[2016-06-26 01:21:53] $ git clone --recursive 'https://github.com/scrooloose/nerdtree.git' 'C:UsersNeil/vimfiles/bundle/nerdtree'
[2016-06-26 01:21:53] > sh: git: command not found
[2016-06-26 01:21:53] > 
[2016-06-26 01:21:54] 
[2016-06-26 01:21:54] Plugin scrooloose/nerdcommenter
[2016-06-26 01:21:54] $ git clone --recursive 'https://github.com/scrooloose/nerdcommenter.git' 'C:UsersNeil/vimfiles/bundle/nerdcommenter'
[2016-06-26 01:21:54] > sh: git: command not found
[2016-06-26 01:21:54] > 
[2016-06-26 01:21:55] 
[2016-06-26 01:21:55] Helptags:

Now git is definitely available, and on the path.

$ git --version
git version 2.6.1.windows.1

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 16 2015 08:39:39)
Included patches: 1-872
Compiled by <alexpux@gmail.com>
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl/dyn        +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      +python3/dyn     +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby/dyn        +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -D_FORTIFY_SOURCE=2 -I/usr/include/ncursesw  -march=i686 -mtune=generic -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -pipe -fstack-protector -pipe -Wl,--as-needed -o vim.exe
 -lm    -lncursesw -liconv -lintl   -pipe -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -ldl -lcrypt

~/_vimrc:

" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible


" -------------- Set up Vundle -------------
filetype off

set rtp+=$HOME/vimfiles/bundle/Vundle.vim/
call vundle#begin('$USERPROFILE/vimfiles/bundle/')

Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required



" ----------- CUSTOM vimrc stuff -----------------------------
syntax enable   " enable syntax processing
set number      " show line numbers
" set showcmd       " show last run command in the bottom right
" set cursorline    " highlight current line where cursor is
set wildmenu    " enable context menu showing autocomplete options
set showmatch   " highlight matching parentheses and so forth to the character you're on
" set incsearch " search as characters are entered
" set hlsearch  " highlight matches
nnoremap B ^    " move to beginning of line using B instead of ^
nnoremap E $    " move to end of line using E instead of $

This is on Windows 10.

@anonymouss
Copy link

Hi,
Which vim do you use? The vim integrated in cmder or gvim you installed?
The git and vim integrated in cmder can not be used outside of cmder. If you use gvim, maybe you can add the git path ...\cmder\vendor\git-for-windows\... into system path and try again.

@Aifryz
Copy link

Aifryz commented Jul 11, 2016

Hello,
One way I managed to fix this is by running vim from bash. Somehow, when vim is launched directly from cmdr PATH is "mangled" and Git/bin is changed to Git/bin/usr. No idea why or where it happens.

@neil-s
Copy link
Author

neil-s commented Jul 11, 2016

Thanks @Aifryz , that workaround fixed the issue, although I'm not entirely sure why. I'll leave the issue open so the devs can isolate the underlying issue.

@anonymouss I use the vim integrated in cmder, with the git integrated in cmder. I also added the \cmder\vendor\git-for-windows\bin folder to the system path for good measure. Didn't help.

@neil-s
Copy link
Author

neil-s commented Aug 1, 2016

@nfischer I think there's an issue with how Vundle is handling slashes in directory names, and hence struggling to find the system git. The workaround does not actually fix the underlying issue, so I would keep the issue open.

@jep-dev
Copy link

jep-dev commented Feb 23, 2017

#475 may be related - it references #374 (among others) which suggests that the 'noshellslash' option may fix path errors like this. I could be way off base, but hopefully this helps.

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

4 participants