nfpyfzyf
nfpyfzyf

Reputation: 2981

How to add vim-plugins into git repo?

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 directories 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 test vimgitrepo github page

Upvotes: 1

Views: 760

Answers (1)

pktangyue
pktangyue

Reputation: 8524

You copied the whole directories into your repo, which are other git repos and contains .git/ directory in them.

So you have two way to solve it:

  1. use command git submodule, set them as submodules.
  2. delete the .git/ in these directories before your first commit.

Upvotes: 4

Related Questions