You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I couldn't figure out why ghorg would clone just fine a few public repos from a GitHub org I'm trying to backup but then as soon as it got to a private repo, I was presented with the interactive prompt that git typically shows when it needs credentials:
Username for `https://github.com`:
Password for `https://github.com`:
The cloning would, as a result, get stuck there until I filled in my credentials.
I immediately thought of some issue with the token I had set in the config file so I went to test it manually but it worked just fine. Also, to my surprise, inspecting the output folder showed that the private repos had successfully been cloned. Running the command again with GHORG_DEBUG=1 and --concurency=1 showed me what the exact problem was:
I had modified the sample config file provided in the README.md and I had set GHORG_FETCH_ALL: true. This option clones the repository correctly using the https://<username>:<token>@github.com/<org>/<repo>.git URL but then it manually updates the remote's URL with the git set-url command leaving out the token (e.g. https://github.com/<org>/<repo>.git).
Subsequently, when git fetch --all runs it tries to fetch all branches using the plain URL (without the token) and that's why I get the login prompt.
In my opinion, when trying to clone using a token via https, GHORG_FETCH_ALL should either have no effect or ghorg should exit immediately with an error.
P.S. eventually I found out what I was actually looking for was just GHORG_BACKUP but that's beside the point so I got my backup working in the end but I still wanted to report this for posterity :)
The text was updated successfully, but these errors were encountered:
Describe the bug
I couldn't figure out why
ghorg
would clone just fine a few public repos from a GitHub org I'm trying to backup but then as soon as it got to a private repo, I was presented with the interactive prompt thatgit
typically shows when it needs credentials:The cloning would, as a result, get stuck there until I filled in my credentials.
I immediately thought of some issue with the token I had set in the config file so I went to test it manually but it worked just fine. Also, to my surprise, inspecting the output folder showed that the private repos had successfully been cloned. Running the command again with
GHORG_DEBUG=1
and--concurency=1
showed me what the exact problem was:I had modified the sample config file provided in the
README.md
and I had setGHORG_FETCH_ALL: true
. This option clones the repository correctly using thehttps://<username>:<token>@github.com/<org>/<repo>.git
URL but then it manually updates the remote's URL with thegit set-url
command leaving out the token (e.g.https://github.com/<org>/<repo>.git
).Subsequently, when
git fetch --all
runs it tries to fetch all branches using the plain URL (without the token) and that's why I get the login prompt.In my opinion, when trying to clone using a token via https,
GHORG_FETCH_ALL
should either have no effect orghorg
should exit immediately with an error.P.S. eventually I found out what I was actually looking for was just
GHORG_BACKUP
but that's beside the point so I got my backup working in the end but I still wanted to report this for posterity :)The text was updated successfully, but these errors were encountered: