git ls-remote returns "fatal: No remote configured to list refs from."

7.9k Views Asked by At
$ git ls-remote 

results in

fatal: No remote configured to list refs from.

I have remotes defined

$ git remote

results in

personal_remote
upstream
4

There are 4 best solutions below

1
jthill On BEST ANSWER

I can get this behavior in repos that have no origin remote. You can supply an alternate default remote name by setting remote.pushDefault.

0
user2992301 On

We can provide remote in the command:

git ls-remote personal_remote

Command worked for me on git version 1.9.1

0
Mark On

If using git from VS Developer Command Prompt, it helps to change directory to the root of the git repository, i.e. the folder that contains the .git folder.

Running the git ls-remote command from there will pick up the remote repository from the directory.

0
senthil sivasamy On

first git init it directory, then git clone the rep ../../something.git then go into that folder , then try git ls-remote. it should be good.