我有一个不寻常的想法来使用git作为备份系统。假设我有一个目录./backup/myfiles,我想使用git对其进行备份。为了保持干净,我不想在myfiles文件夹中有一个.git目录,所以我想我可以创建./backup/git_repos/myfiles。通过查看git文档,我尝试这样做:
$ cd backup/myfiles
$ mkdir ../git_repos/myfiles
$ git --git-dir=../git_repos/myfiles init
Initialized empty Git repository in backup/git_repos/myfiles/
$ git --git-dir="../git_repos/myfiles/" add foo
fatal: pathspec 'foo' did not match any files
您会看到我到达那里的错误消息。我究竟做错了什么?