Git говорит, что мой путь .gitignore недопустим и не может быть добавлен - PullRequest
0 голосов
/ 13 ноября 2018

У меня очень простая проблема, и я не понимаю, в чем дело. Я пытаюсь подготовить файл .gitignore для коммита, но Git говорит, что путь неверен. Просто так. Мой вывод терминала вставлен ниже. Как видите, файл .gitignore действительно есть, но я не могу его добавить.

magnus@magnus:~/Documents/deep-rl-hex$ git status
On branch neural_net_added
Your branch is up to date with 'origin/neural_net_added'.

nothing to commit, working tree clean


magnus@magnus:~/Documents/deep-rl-hex$ ls -alt .git/
    total 68
    drwxr-xr-x   8 magnus magnus 4096 nov.  13 17:48 .
    -rw-r--r--   1 magnus magnus 2436 nov.  13 17:48 index
    -rw-r--r--   1 magnus magnus   41 nov.  13 17:48 ORIG_HEAD
    drwxr-xr-x   5 magnus magnus 4096 nov.  13 17:48 refs
    drwxr-xr-x 160 magnus magnus 4096 nov.  13 17:48 objects
    -rw-r--r--   1 magnus magnus 1427 nov.  13 17:39 .gitignore #.gitignore file is indeed here
    drwxr-xr-x   5 magnus magnus 4096 nov.  13 17:38 ..
    -rw-r--r--   1 magnus magnus   33 nov.  13 17:38 HEAD
    -rw-r--r--   1 magnus magnus  221 nov.  13 17:38 FETCH_HEAD
    -rw-r--r--   1 magnus magnus  348 nov.  13 17:28 config
    -rw-r--r--   1 magnus magnus    4 nov.  13 17:27 COMMIT_EDITMSG
    drwxr-xr-x   3 magnus magnus 4096 okt.  27 14:35 logs
    -rw-r--r--   1 magnus magnus  114 okt.  27 14:35 packed-refs
    drwxr-xr-x   2 magnus magnus 4096 okt.  27 14:35 hooks
    drwxr-xr-x   2 magnus magnus 4096 okt.  27 14:35 info
    drwxr-xr-x   2 magnus magnus 4096 okt.  27 14:35 branches
    -rw-r--r--   1 magnus magnus   73 okt.  27 14:35 description


magnus@magnus:~/Documents/deep-rl-hex$ git add .git/.gitignore
    error: Invalid path '.git/.gitignore'
    error: unable to add .git/.gitignore to index
    fatal: adding files failed

В чем здесь проблема? Совершенно очевидно, что я упускаю что-то элементарное, но не могу понять, что.

Ответы [ 2 ]

0 голосов
/ 13 ноября 2018

Ваш .gitignore файл, как и все другие файлы в вашем рабочем дереве, принадлежит за пределами каталога .git.git add не относится к файлам в .git.

0 голосов
/ 13 ноября 2018

добавление файла в каталог .git.Это no no.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...