不是git存储库:' .git'子文件夹

时间:2016-06-07 14:47:37

标签: git github bitbucket

自从我升级git(Im on 2.8.1版)以来,这个错误开始出现。

我可以在任何存储库(github或bitbucket)中复制它。基本上如果一个repo有一个子目录,git命令就无法将它识别为有效的git repo。

enter image description here

mus文件夹内容:

➜  shinylang git:(master) ls -la mus
total 8
drwxr-xr-x  3 sandeep  staff   102 Jun  7 10:32 .
drwxr-xr-x  5 sandeep  staff   170 Jun  7 10:32 ..
-rw-r--r--  1 sandeep  staff  3523 Jun  7 10:32 compiler.js

这是测试github repo https://github.com/csandeep/shinylang

我的.gitconfig

[user]
    email = sandeep@##########
    name = Sandeep Chayapathi

[alias]
        co = checkout
        st = status
[core]
    excludesfile = /Users/sandeep/.gitignore_global
    editor = mate -wl1
    trustctime = false
[difftool "sourcetree"]
    cmd = /Users/sandeep/Applications/Perforce/p4merge.app/Contents/MacOS/p4merge \"$LOCAL\" \"$REMOTE\"
    path = 
[mergetool "sourcetree"]
    cmd = /Users/sandeep/Applications/Perforce/p4merge.app/Contents/MacOS/p4merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
    trustExitCode = true
[merge]
    conflictstyle = diff3
    tool = sourcetree
[rerere]
    enabled = false
[mergetool "Kaleidoscope"]
    cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
    trustexitcode = true
[difftool "Kaleidoscope"]
    cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[mergetool "p4mergetool"]
    cmd = /Users/sandeep/Applications/Perforce/p4merge.app/Contents/Resources/launchp4merge \"$PWD/$BASE\" \"$PWD/$REMOTE\" \"$PWD/$LOCAL\" \"$PWD/$MERGED\"
    trustExitCode = false
[difftool "p4mergetool"]
    cmd = /Users/sandeep/Applications/Perforce/p4merge.app/Contents/Resources/launchp4merge \"$LOCAL\" \"$REMOTE\"
[mergetool]
    prompt = false
    keepBackup = false
    trustExitCode = false
[diff]

[mergetool "extMerge"]
    cmd = extMerge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
[diff]
    guitool = extDiff
[filter "media"]
    required = true
    clean = git media clean %f
    smudge = git media smudge %f
[filter "hawser"]
    clean = git hawser clean %f
    smudge = git hawser smudge %f
    required = true
[filter "lfs"]
    clean = git-lfs clean %f
    smudge = git-lfs smudge %f
    required = true

注意:删除.gitignore文件可以解决此问题。奇怪地将其添加回来不再触发此问题。总而言之,我见过的一个最奇怪的错误。

1 个答案:

答案 0 :(得分:0)

如果没有mus/.git,则mus本身不是git repo。您可以git add musmus及其内容添加到shinylang回购,或在git init内运行mus以将其初始化为单独的回购,但子模块是除非绝对必要,否则应该避免使用。