3
$ git ls-remote 

results in

fatal: No remote configured to list refs from.

I have remotes defined

$ git remote

results in

personal_remote
upstream
eebbesen
  • 5,070
  • 8
  • 48
  • 70

4 Answers4

5

We can provide remote in the command:

git ls-remote personal_remote

Command worked for me on git version 1.9.1

Pang
  • 9,564
  • 146
  • 81
  • 122
user2992301
  • 51
  • 1
  • 2
4

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

jthill
  • 55,082
  • 5
  • 77
  • 137
  • 1
    @jthill correctly points out that `ls-remote` is expecting a remote with the name `origin`. The solution is to either rename one of the remotes to `origin` or use `remote.pushDefault` to tell `ls-remote` which to use. – eebbesen Feb 07 '17 at 15:01
1

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.

0

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.

Mark
  • 551
  • 6
  • 13