fatal not a git repository or any of the parent directories git что делать

Получение «fatal: Not a git repository» при попытке удаленного добавления репозитория Git

Я представляю себя Git, следуя этому руководству:

все работает нормально до той части, где РЕПО добавляется к моей локальной машине:

(после замены имени пользователя, NFSNSERVER и REPOAME с правильными именами) я получаю сообщение об ошибке:

можете ли вы помочь мне пройти этот шаг?

22 ответов

вы ввели локальный репозиторий Git, в который предполагается добавить этот пульт?

вам нужно cd в репозиторий / рабочую копию, или вы не инициализировали или не клонировали репозиторий в первую очередь, в этом случае вам нужно инициализировать РЕПО в каталоге где вы хотите разместить РЕПО:

или клонировать репозиторий

Примечание: это не отвечает на общую проблему, которая была проблемой OP, но к другой проблеме, где это сообщение об ошибке может возникнуть. Мне не хотелось делать новый вопрос, чтобы записать этот ответ, скажите мне, Должен ли я сделать это вместо этого 😛

так как у меня не было ничего, что действительно нуждалось в сохранении, я просто пошел с dummy way и сделал.

по крайней мере для меня reflog ( git reflog ) исчезнуть полностью. Следовательно, если вы сделаете сброс, и были некоторые изменения, которые вы хотели предотвратить, я не уверен, что вы можете вернуть их после сброса. Поэтому убедитесь, что у вас есть все изменения, которые вы не можете потерять, в конечном счете, просто скопировав клон перед попыткой этого.

проблема пустой головной файл.

в командной строке / CLI вы получите эту ошибку, если ваш текущий каталог не является репозиторием. Итак, вы должны сначала CD в репо.

эта проблема возникла у меня после того, как я переместил местоположение проекта git в файловой системе. Когда я запускал некоторые команды git, произошла ошибка, например:

Я нашел в /home/rospasta/path_old/gitprojecta/.travis/.git был записан абсолютный путь к старому местоположению проекта. Вручную обновление этого пути нового местоположения решило проблему для меня.

поэтому моя проблема может быть или не быть проблемой git, но HTH.

затем снова инициализируйте git-РЕПО

просто введите следующее в cmd или git shell или любом другом терминале:

для этого вам нужно ввести одну команду, которая отсутствует в командах bitbucket

пожалуйста, попробуйте git init.

устранение:

даже у меня была такая же проблема. я написал сценарий оболочки, который будет создавать резервные копии всех моих кодов в моем РЕПО git в рабочие дни недели в 17: 55 с помощью crontab. увидев журналы cron, я нашел вышеупомянутую проблему.

и еще одна вещь на cmd перейдите в свой репозиторий git или cd, чтобы где ваш клон находится в вашем окне, обычно они будут храниться в документах под GitHub cd Document/Github / yourproject после этого вы можете иметь любые команды git

поэтому перейдите в каталог в каталог репозитория, где у вас есть проверка кода из git, а затем запустите эту команду.

GIT_DIR должен быть unset: unset GIT_DIR

в моем случае я обнаружил, что git в windows стал чувствительным к регистру для буквы диска с некоторого момента.

после обновления двоичного файла git в командах cli windows, которые раньше работали, остановились. например, путь в скрипте был D:\bla\file.txt, в то время как команда git принято только d:\bla\file.txt

все вернулось в норму, и git также распознал мои измененные / неустановленные файлы.

я исправил это, восстановив корневые файлы.

У меня была эта проблема с плагином Jenkins Git после проблем аутентификации с GitLab. Дженкинс докладывал о Хадсоне.подключаемый модуль.мерзавец.GitException: [. ]stderr: GitLab: проект, который вы искали, не найден. фатальная ошибка: не удалось прочитать из удаленного репозитория.’

однако, если я сделал «git clone» или «git fetch» непосредственно из окна Дженкинса (командной строки), он работал без проблем.

проблема была решена с помощью удаление весь /рабочая область каталог в папке Jenkins jobs для этого конкретного задания, например

Источник

Git: Receiving «fatal: Not a git repository» when attempting to remote add a Git repo

I am introducing myself to Git by following this tutorial:

Everything works fine up until the part where the repo is added to my local machine:

(After replacing USERNAME, NFSNSERVER, and REPONAME with the correct names) I receive the following error:

Can you help me get past this step?

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

32 Answers 32

Did you init a local Git repository, into which this remote is supposed to be added?

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

You’ll either need to cd into the repository/working copy, or you didn’t initialize or clone a repository in the first place, in which case you need to initialize a repo in the directory where you want to place the repo:

or clone a repository

The problem was empty HEAD file.

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

NOTE: this does not answer to the common problem, which was OP’s problem, but to different problem where this error message may come up. I didn’t feel like doing new question just to write this answer down, tell me if I should do that instead 😛

Since I didn’t have anything that really needed preserving, I just went with dummy way, and did.

At least for me reflog ( git reflog ) disappeared completely. Hence, if you do the reset, and there was some changes you wanted to prevent, I’m not sure you can get them back after reset anymore. So, make sure that you have all changes you can’t lose backed up, ultimately by just copying the clone before trying this.

Источник

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

What does “fatal: not a git repository” mean?

This error means you attempted to run a Git command, but weren’t inside a Git repository. Make sure you’ve:

Usually, this is enough to fix the error. However, if that doesn’t do it, or you’re just curious about what it all means, let’s dig in.

A Git command needs to be run on a specific repository, so this error typically occurs when a Git command is run in a directory that Git doesn’t know about. In these cases, the fix is to make sure that you are both working in the correct folder and that you set up your repository right.

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

How do Git repositories work?

The reason for the (or any of the parent directories) part of the error is that Git will actually travel up the directory tree to the root of your computer looking for that `.git` folder. In plain English, it checks the folder that you’re currently in, and then the folder containing that folder, and so on, up as far as possible.

That’s why, if you’re working in a Git repository, you can `cd` into a child folder and still be able to run Git commands just fine.

Note: if you create a Git repository inside another repository, Git will treat that repository independently of its parent. In other words, Git will use the first `.git` folder it finds and treat its parent folder, along with all that folders children, as the current repository.

How to really know you’re in a Git repository

Generally speaking, you can get a Git repository locally in one of two ways. One way is to run the `git clone` command and clone a repository from an existing repository (whether that repository exists locally on your computer or on a server running Git such as GitHub.com). The other way is to initialize a new Git repository using the `git init` command to set up version tracking in a new folder.

Either way, that `.git` folder I mentioned should exist in the repository’s root (top-most folder). If `ls` and seeing your project’s folders isn’t enough for you, there’s another technique to be even more sure that you’re in the right place. That period in front of the `.git` folder means that it’s actually a hidden folder, so it won’t show up in your Finder or Explorer window and is typically only meant for scripts and OS-level commands to access.

With a bit of magic, though, we can see it ourselves. You just need to add a flag to the `ls` command that will ask it to show hidden folders, and that’s the `-laf` flag.
The command looks like this:

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

As you can see, that command spat out a list of local files and folders with a bunch of extra gobbledegook, arranged into a table. The most important folder we’re looking for is that `.git` folder. If you see it, that means you’re in a Git repository.

If that doesn’t fix it, check your HEAD file

As I mentioned at the beginning of this article, there’s another way this exact error can occur: if your HEAD file is corrupted.

The HEAD file is a file that sits directly in the `.git` directory, and it contains some information that points Git to the current branch that you’re working on. If your HEAD file is somehow emptied or corrupted, you’ll start seeing the exact same error, even though you are currently in a correctly initialized repository.

To check that the HEAD file contains the correct contents, you can run the `cat` command:

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

If this produces an unexpected result, figure out which branch you’re working in and then put that into the HEAD file.

Read more about the HEAD file here, including what format the contents should be in. Good luck!

Источник

When I try to put images into the Resources folder of my project, I got this message :

How can I fix that?

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

5 Answers 5

Had the same problem. I copied a project then tried to delete files.

If you want to be able to edit the project, type git init folder in the terminal. This will re-initialize the git in your folder.

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

Go to Organizer->Repositories and remove the Corresponding repository.

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

Faced the same problem in Xcode 4.6.1 after moving my folder and xcodeproj file. Here’s what works for me:

In order to do anything in Git, you have to have a Git repository. This is where Git stores the data for the snapshots you are saving.

so just go into your project directory let say you have a project name test_project just go into that directory and type the command

and this will work.

Perform these two steps in Xcode 11, to get rid of this error:

Not the answer you’re looking for? Browse other questions tagged ios xcode4 or ask your own question.

Linked

Related

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.11.9.40693

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

GIt fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)

I did a git pull on my repo and ever since I’ve done so I’ve been getting errors anything I do anything with git. The error I typically get is:

Any idea what is causing this?

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

2 Answers 2

You are calling git pull on not a git repository.

First initialize the repo as:

Then add your repo origin as:

Then call git pull or push your code.

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

If you call git pull on a non git repository, you will get the error.

Steps to resolve the error:

cd directory of the repository you cloned.

Now you can either git pull or git checkout branchname

fatal not a git repository or any of the parent directories git что делать. Смотреть фото fatal not a git repository or any of the parent directories git что делать. Смотреть картинку fatal not a git repository or any of the parent directories git что делать. Картинка про fatal not a git repository or any of the parent directories git что делать. Фото fatal not a git repository or any of the parent directories git что делать

Not the answer you’re looking for? Browse other questions tagged git github or ask your own question.

Related

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.11.9.40693

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *