"git ls-remote" fails on circleci - "make sure you have the correct access rights" error


#1

The 2nd git ls-remote command does not work. My job is configured to be able to access https://github.com/some-other-repo. Any idea?

version: 2
jobs:
  one:
    docker:
      - image: circleci/android:api-25-alpha
    steps:

      # Check out https://github.com/current-repo 
      - checkout
      
      # ls-remote works today properly. 
      - run: git ls-remote https://github.com/current-repo 

      # ls-remote does not work.  
      # My job is already configured to be able to access this repo
      - run: git ls-remote https://github.com/some-other-repo 

      # ERROR: Repository not found.
      # fatal: Could not read from remote repository.
      # Please make sure you have the correct access rights and the repository exists.
      # Exited with code 128
workflows:
  version: 2
  one_and_two:
    jobs:
      - one      

#2

Deleting ~/.gitconfig which contains the following did not help.

[url “ssh://git@github.com”]
insteadOf = https://github.com
[gc]
auto = 0


#3

I simplified my config.yml in my original post. Please let me know if anyone has ideas. Thanks!


#4

Found a solution. Looks like I have to execute git clone in order to use git ls-remote on Circleci.

      command: |
        git clone https://github.com/some-other-repo 
        # now git ls-remote works
        git ls-remote https://github.com/some-other-repo