This command works đồ sộ get the files and compile them:

git clone a-valid-git-url

for example:

git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts

However, git status (or any other git command) then gives the above fatal: Not a git repository (or any of the parent directories) error.

What am I doing wrong?

asked Aug 14, 2012 at 22:14

1

You have đồ sộ actually cd into the directory first:

$ git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts
Cloning into 'liggghts'...
remote: Counting objects: 3005, done.
remote: Compressing objects: 100% (2141/2141), done.
remote: Total 3005 (delta 1052), reused 2714 (delta 827)
Receiving objects: 100% (3005/3005), 23.80 MiB | 2.22 MiB/s, done.
Resolving deltas: 100% (1052/1052), done.

$ git status
fatal: Not a git repository (or any of the parent directories): .git
$ cd liggghts/
$ git status
# On branch master
nothing đồ sộ commit (working directory clean)

answered Aug 14, 2012 at 22:19

1

I just got this message and there is a very simple answer before trying the others. At the parent directory, type git init

This will initialize the directory for git. Then git add and git commit should work.

Syden

8,6255 gold badges28 silver badges46 bronze badges

answered Jan 10, 2017 at 21:40

2

In my case, was an environment variable GIT_DIR, which I added đồ sộ access faster.

This also broke all my local repos in SourceTree :(

answered Oct 2, năm ngoái at 9:15

1

Sometimes its because of ssh. So you can use this:

git clone https://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts

instead of:

git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts

answered Dec 19, năm 2016 at 3:44

2

If Existing Project Solution is planned đồ sộ move on TSF in VS Code:

open Terminal and lập cập following commands:

  1. Initialize git in that thư mục (root Directory)

    git init

  2. Add Git

    git add .

  3. Link your TSf/Git đồ sộ that Project - {url} replace with your git address

    git remote add origin {url}

  4. Commit those Changes:

    git commit -m "initial commit"

  5. Push - I pushed code as version1 you can use any name for your branch

    git push origin HEAD:Version1

answered Jun 17, 2020 at 8:46

This error got resolved when I tried initialising the git using git init . It worked

answered Jan 26, 2019 at 21:51

in my case, i had the same problem while i try any git -- commands (eg git status) using windows cmd. ví what i tự is after installing git for window https://windows.github.com/ in the environmental variables, add the class path of the git on the "PATH" varaiable. usually the git will installed on C:/user/"username"/appdata/local/git/bin add this on the PATH in the environmental variable

and one more thing on the cmd go đồ sộ your git repository or cd đồ sộ where your clone are on your window usually they will be stored on the documents under github

cd Document/Github/yourproject

after that you can have any git commands

EricSchaefer

26.2k21 gold badges74 silver badges105 bronze badges

answered Aug 11, năm trước at 17:41

git clone https://github.com/klevamane/projone.git
Cloning into 'projone'...
remote: Counting objects: 81, done.
remote: Compressing objects: 100% (66/66), done.
remote: Total 81 (delta 13), reused 78 (delta 13), pack-reused 0
Unpacking objects: 100% (81/81), done.

you have đồ sộ "cd projone"

then you can kiểm tra status.


One reason why this was difficult đồ sộ notice at first, i because you created a thư mục with the same name already in your computer and that was where you cloned the project into, ví you have đồ sộ change directory again


answered Aug 30, 2017 at 6:31

I had another problem. I was in a git directory, but got there through a symlink. I had đồ sộ go into the directory directly (i.e. not through the symlink) then it worked fine.

answered Aug 14, năm trước at 16:56

In my case, the original repository was a bare one.

So, I had đồ sộ type (in windows):

mkdir   dest
cd dest
git init
git remote add origin a\valid\yet\bare\repository
git pull origin master

To kiểm tra if a repository is a bare one:

git rev-parse --is-bare-repository 

answered Aug 9, 2017 at 10:34

Simply, after you clone the repo you need đồ sộ cd (change your current directory) đồ sộ the new cloned thư mục

git clone https://[email protected]/Repo_Name.git

cd Repo_Name

answered Jul 10, 2017 at 13:16

for me; I had been having problems getting the solution đồ sộ clean properly in Visual Studio, ví I did a wildcard delete of any directories called bin, obj... .git has a directory called /objects which was caught up in the delete. I discovered when doing a kdiff of the working clone and the broken one. oops :)

answered Oct 27, 2023 at 14:20

I suddenly got an error lượt thích in any directory I tried đồ sộ lập cập any git command from:

fatal: Not a git repository: /Users/me/Desktop/../../.git/modules/some-submodule

For má, turned out I had a hidden tệp tin .git on my Desktop with the content:

gitdir: ../../.git/modules/some-module

Removed that tệp tin and fixed.

answered Oct 4, 2018 at 19:39

i have the same problem from my office network. i use this command but its not working for me url, ví lượt thích this: before $ git clone https://gitlab.com/omsharma/Resume.git

After i Use this URL : $ git clone https://[email protected]/omsharma/Resume.git try It.

answered Apr 19, 2019 at 5:49

In my case I was dealing with github workflow jobs and simply forgot đồ sộ checkout the repo before my step. Adding pre requisite step actions/checkout@v2 resolved the issue.

answered Dec 12, 2022 at 6:31