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

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
      - image: circleci/android:api-25-alpha

      # 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
  version: 2
      - one      

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

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

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

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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.