我正在使用git来控制Linux家用电脑上的用户配置文件的版本。
Git拒绝将这两个文件添加到用户配置存储库:
~/.emacs.d/.cache/bookmarks
~/.emacs.d/.cache/recentf
目录emacs。d/包含一个。git存储库。
外部的所有文件。emacs。d/在没有问题的情况下添加。
有没有办法跟踪这两个文件,就好像它们不在另一个git存储库中一样?
Git子模块似乎有点过头了。
我正在Fedora 35工作站上运行git 2.33.1版。
以下是一些可能相关的其他事项:
gitc别名在my中定义。bashrc文件:
alias gitc='/usr/bin/git --git-dir=$HOME/config_repo --work-tree=$HOME'
Git add执行并以静默方式返回,但未添加任何内容:
$ gitc add .emacs.d/.cache/bookmarks .emacs.d/.cache/recentf
$ gitc status
On branch clean_install_orphan
nothing to commit (use -u to show untracked files)
这个emacs。d/。缓存/文件未列在跟踪的提交文件中:
$ gitc ls-files .emacs.d/.cache/bookmarks .emacs.d/.cache/recentf
不返回任何内容。
编辑完之后。emacs。d/。cache/recentf文件,未在以下文件中列出:
$ gitc status
因为它从未被添加。
“添加力”选项会得到类似的结果:
$ gitc add -f .emacs.d/.cache/bookmarks .emacs.d/.cache/recentf
文件存在且路径正确:
$ cd ~
$ ls -l .emacs.d/.cache/recentf
-rw-------. 1 wolfv wolfv 2999 Jan 11 00:41 .emacs.d/.cache/recentf
$ ls -l .emacs.d/.cache/bookmarks
-rw-r--r--. 1 wolfv wolfv 1663 Jan 2 10:39 .emacs.d/.cache/bookmarks
没有。吉特。Gitu在家中忽略全局文件。
存储库的排除文件为空:
$ more config_repo/info/exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
初始化存储库时使用了--bare选项:
$ git init --bare $HOME/config_repo
这应该不会造成问题。
.缓存不是符号链接:
$ ls -la .emacs.d/
..
drwxr-xr-x. 1 wolfv wolfv 452 Jan 11 00:41 .cache
..