2

I am trying to clone an Azure repo within my company's network. Sadly it fails on one single repo inside my org. It works on all other repos (all repos are identically configured).

git clone https://user:<PersonalAccessToken>@dev.azure.com/<somePath> git_workdir
Cloning into 'git_workdir'
error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
fatal: the remote end hung up unexpectedly

Since the HTTP status code is a 403 Forbidden one might think I lack access rights, but I re-generated a valid Azure Personal Access token so I am sure I have them.

I tried GIT_TRACE=1 GIT_TRACE_PACKET=1 GIT_CURL_VERBOSE=1 for diagnosis but no useful info was printed.

I have no idea what is going on, my best guess is that it's related to repo size (it's much larger than other repos) and/or some shenanigans with our org's internal proxy (which is causing us a lot of other issues already).

xjcl
  • 12,848
  • 6
  • 67
  • 89
  • A guess: your proxy times out while your Git server prepares to deliver the large clone. The shallow clone takes less time to prepare, and your proxy doesn't time out. – torek Oct 07 '21 at 11:29

1 Answers1

1

A workaround I found was

git clone --depth 1 <URL> clone_dir
cd clone_dir
git fetch --unshallow
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin

The first command only clones the most recent commit, and --unshallow then goes and gets all previous commits.

The second fetch is needed because otherwise checkout of branches did not work for me. Inspired by this answer.

xjcl
  • 12,848
  • 6
  • 67
  • 89