git in / etc中不可见

  • 本文关键字:etc in git git git-branch
  • 更新时间 :
  • 英文 :


我试图将各种配置文件和脚本放入git中,但是在此服务器上,git的行为奇怪,似乎拒绝遍历父级目录以找到.git branch root。

/ # git init
/ # git status
# On branch master
nothing to commit (use -u to show untracked files)

到目前为止很好。

/ # cd etc/
/etc # git status 
# Not currently on any branch.
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)

嗯? - 我不应该在分支机构上吗?

如果我尝试添加一些东西:

/etc # git add passwd
fatal: Unable to create '//etc/.git/index.lock': No such file or 
directory

为什么git搜索parent parent the Branch root(.git)?

为什么不会

您以前在/etc中初始化了git。delete/etc/.git和git将击中/.git文件夹。理论上。我认为出于某种晦涩的原因,您无法使用/.git。您需要使用GIT_DIR环境变量将其重新定位。

相关内容

最新更新