1

I created a git repo and add vim-plugins ( which is installed by vundle) into it, after I pushed this repo to github, and clone this repo to another server, I found that vim-plugin's directory is empty, dirs and files under vim-plugin's directory are all missing

How to produce it:

$ make a new test user in Linux, then ( su - test )
$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle # install vundle
$ echo "
  set nocompatible
  filetype off
  set rtp+=~/.vim/bundle/vundle/
  call vundle#rc()
  Bundle 'gmarik/vundle'
  Bundle 'Lokaltog/vim-powerline'
  filetype plugin indent on
  " >> .vimrc
$ vim # run vim command `:BundleInstall`
$ mkdir vimgitrepo && cd vimgitrepo && git init
$ cp -a ~/.vim/bundle .
$ git status
  # On branch master
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
  #       bundle/
  nothing added to commit but untracked files present (use "git add" to track)
$ git add .
$ git status
  # On branch master
  # Changes to be committed:
  #   (use "git reset HEAD <file>..." to unstage)
  #
  #       new file:   bundle/vim-powerline
  #       new file:   bundle/vundle
  #

As you can see, only dir are added.

$ git commit -m'test'
$ git push -u origin master

And if you clone this repo on another place, only empty directory exists.

Here is github page

nfpyfzyf
  • 2,891
  • 6
  • 26
  • 30
  • Could you share that github repo's address so that we can test it ourself? – romainl May 02 '13 at 07:38
  • @romainl, There's nothing but an empty vim-powerline directory in that repo...But you can test follow above instructions. All you just need to do is install vim-powerline or whatever vim-plugins using vundle.Thanks. – nfpyfzyf May 02 '13 at 07:45
  • Hmm, no thanks, I don't use vundle. How did these plugins get there? Using `:BundleInstall` or using `$ git clone`? – romainl May 02 '13 at 09:16

3 Answers3

1

You need to make sure you have added those files and committed them in your local repo before pushing it to GitHub.
See for example "GIT add vs push vs commit".

And make sure that your directories (like .vim/bundle/vim-powerline) aren't empty (otherwise, they wouldn't be added to the index: only files can be versioned)

Also check if the files in those directories aren't already ignored (by a .gitignore file).
As explained in "Show ignored files in git", do a:

git clean -ndX

To list the files that would not be added.

Finally, not that directories which are symlinks would be added as file.
That would explain:

  • why your git status mentions a new file, and
  • why a clone of that repo display an empty directory.

See "What does git do to files that are a symbolic link?":

git just stores the contents of the link (i.e. the path of the file system object that it links to) in a 'blob' just like it would for a normal file.
It then stores the name, mode and type (including the fact that it is a symlink) in the tree object that represents its containing directory.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes, I added and it's not empty. I tried again. And I found after I `git add .`, git only shows : `new file: .vim/bundle/vim-powerline`, I'm sure `.vim/bundle/vim-powerline` is not empty. – nfpyfzyf May 02 '13 at 06:02
  • @nfpyfzyf did you and, *and* commit? And are the files you are trying to add already ignored (by a `.gitignore` file) – VonC May 02 '13 at 06:02
  • Yes, and it's not in .gitignore file. – nfpyfzyf May 02 '13 at 06:07
  • @nfpyfzyf are those files visible in your GitHub repo, once you have pushed them? – VonC May 02 '13 at 06:08
  • In the example above, it's not a symlink, I hard copy the vim-powerline into `test` git repo. – nfpyfzyf May 02 '13 at 06:35
  • @nfpyfzyf So it is an actual directory, but when added, it is viewed by git as a file? I only see this for symlinks. – VonC May 02 '13 at 06:37
1

Are you using vundle as plugin manager?

I experienced the same problem and the issue was that vundle, I don't know if Pathogen does the same, clone the github repositories and includes the .git file into the plugin directory, so the directory's content is not included in you project.

I solve this issue with this sequence:

  1. 'find . -name .gitignore -exec rm -rf {} \;', to remove all .git directories.
  2. 'git init' to init repo (I remove all. git folders in step 1).
  3. git add . (add all files again).

And all my plugin directories were included.

Does it solve your problem (I hope so)?

0

can you try with this command in place of git push. git push origin master

Also if you want to share your vim plugin across different machine you can try the solution mentioned in another question How to share one vimrc file among multiple clients?

Community
  • 1
  • 1