无法将目录添加到git repo

时间:2014-03-18 02:15:21

标签: git github git-submodules

我想在一个文件夹中收集一些点文件并将其保存在GitHub上。

因此,dotfiles目录对我来说是.vim

我也移动了.xmonad个文件夹。但不幸的是,当我想将我的环境复制到其他计算机时,我意识到我的GitHub仓库中.vim/xmonad/是空的。

git add xmonad没有做任何事情。

git add xmonad/*出现以下错误:

致命:路径' xmonad / get-volume'在submodule' xmonad'

根据这个帖子(Unable to track files within Git submodules),我检查了我的子模块,从xmonad目录中删除了.git文件,但没有任何帮助。

bv@ln:~$ cd .vim
bv@ln:~/.vim$ ll -a
total 76
drwxrwxr-x  6 bv bv  4096 Mar 18 06:48 ./
drwxr-xr-x 97 bv bv  4096 Mar 18 07:01 ../
drwxrwxr-x  2 bv bv  4096 Nov  4 17:48 autoload/
-rw-rw-r--  1 bv bv   170 Jan 15 12:14 bash_profile
-rw-r--r--  1 bv bv  3868 Jan 15 15:40 bashrc
drwxrwxr-x 19 bv bv  4096 Feb  6 17:32 bundle/
drwxrwxr-x  9 bv bv  4096 Mar 18 07:00 .git/
-rw-rw-r--  1 bv bv    99 Mar 18 06:46 .gitignore
-rw-rw-r--  1 bv bv  1177 Dec 19 12:26 .gitmodules
-rw-rw-r--  1 bv bv   509 Jan 16 19:02 .netrwhist
-rw-rw-r--  1 bv bv 10710 Feb  6 18:16 README.md
-rw-rw-r--  1 bv bv  1243 Dec 20 16:21 tmux.conf
-rw-rw-r--  1 bv bv 10139 Jan 21 13:22 vimrc
drwxr-xr-x  3 bv bv  4096 Mar 18 06:43 xmonad/
-rw-rw-r--  1 bv bv   377 Jan 23 15:44 xsessionrc
bv@ln:~/.vim$ cat .git/config 
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:bv/vim_pathogen.git
fetch = +refs/heads/*:refs/remotes/origin/*
                     [submodule "bundle/command-t"]
                     url = git://git.wincent.com/command-t.git
                     [submodule "bundle/nerdtree"]
                     url = https://github.com/scrooloose/nerdtree.git
                     [submodule "bundle/delmitmate"]
                     url = git://github.com/Raimondi/delimitMate.git
                     [submodule "bundle/tcomment"]
                     url = https://github.com/tomtom/tcomment_vim
                     [submodule "bundle/vim-colors-solarized"]
                     url = git://github.com/altercation/vim-colors-solarized.git
                     [submodule "bundle/tagbar"]
                     url = git://github.com/majutsushi/tagbar.git
                     [submodule "bundle/fugitive"]
                     url = git://github.com/tpope/vim-fugitive.git
                     [submodule "bundle/vim-unimpaired"]
                     url = git://github.com/tpope/vim-unimpaired.git
                     [submodule "bundle/vim-instant-markdown"]
                     url = https://github.com/suan/vim-instant-markdown
                     [submodule "vim-css-color"]
                     url = git@github.com:ap/vim-css-color.git
                     [submodule "bundle/ctrlp"]
                     url = https://github.com/kien/ctrlp.vim.git
                     bv@ln:~/.vim$ find . -name ".git*"
                     ./bundle/vim-colors-solarized/.git
                     ./bundle/indentLine/.gitattributes
                     ./bundle/indentLine/.gitignore
                     ./bundle/indentLine/.git
                     ./bundle/tcomment/.gitignore
                     ./bundle/tcomment/.git
                     ./bundle/vim-rails/.gitignore
                     ./bundle/vim-rails/.git
                     ./bundle/vim-unimpaired/.gitignore
                     ./bundle/vim-unimpaired/.git
                     ./bundle/nerdtree/.gitignore
                     ./bundle/nerdtree/.git
                     ./bundle/vim-surround/.gitignore
                     ./bundle/vim-surround/.git
                     ./bundle/delmitmate/.gitignore
                     ./bundle/delmitmate/.git
                     ./bundle/tagbar/.gitattributes
                     ./bundle/tagbar/.gitignore
                     ./bundle/tagbar/.git
                     ./bundle/ctrlp/.gitignore
                     ./bundle/ctrlp/.git
                     ./bundle/fugitive/.gitignore
                     ./bundle/fugitive/.git
                     ./bundle/vim-slim/.git
                     ./bundle/vim-instant-markdown/.git
                     ./bundle/vim-bundler/.gitignore
                     ./bundle/vim-bundler/.git
                     ./bundle/command-t/doc/.gitignore
                     ./bundle/command-t/.gitattributes
                     ./bundle/command-t/.gitmodules
                     ./bundle/command-t/.gitignore
                     ./bundle/command-t/ruby/command-t/.gitignore
                     ./bundle/command-t/.git
                     ./.gitmodules
                     ./.gitignore
                     ./.git
                     bv@ln:~/.vim$ cat .gitmodules 
                     [submodule "bundle/command-t"]
                     path = bundle/command-t
                     url = git://git.wincent.com/command-t.git
                     [submodule "bundle/nerdtree"]
                     path = bundle/nerdtree
                     url = https://github.com/scrooloose/nerdtree.git
                     [submodule "bundle/delmitmate"]
                     path = bundle/delmitmate
                     url = git://github.com/Raimondi/delimitMate.git
                     [submodule "bundle/tcomment"]
path = bundle/tcomment
url = https://github.com/tomtom/tcomment_vim
[submodule "bundle/vim-colors-solarized"]
path = bundle/vim-colors-solarized
url = git://github.com/altercation/vim-colors-solarized.git
[submodule "bundle/tagbar"]
path = bundle/tagbar
url = git://github.com/majutsushi/tagbar.git
[submodule "bundle/fugitive"]
path = bundle/fugitive
url = git://github.com/tpope/vim-fugitive.git
[submodule "bundle/vim-unimpaired"]
path = bundle/vim-unimpaired
url = git://github.com/tpope/vim-unimpaired.git
[submodule "bundle/vim-instant-markdown"]
path = bundle/vim-instant-markdown
url = https://github.com/suan/vim-instant-markdown
[submodule "vim-css-color"]
path = vim-css-color
url = git@github.com:ap/vim-css-color.git
[submodule "bundle/ctrlp"]
path = bundle/ctrlp
url = https://github.com/kien/ctrlp.vim.git
bv@ln:~/.vim$ git add xmonad/
bv@ln:~/.vim$ git st
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
# modified:   bundle/indentLine (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")
bv@ln:~/.vim$

非常感谢你!

1 个答案:

答案 0 :(得分:1)

好的,https://stackoverflow.com/a/16581096/999973回答帮助了我:

bv@ln:~/.vim$ git ls-tree HEAD xmonad
160000 commit c7a8d9a8f1e9858412e3e05901b20589087212a0  xmonad
bv@ln:~/.vim$ git rm --cached xmonad

现在一切顺利!