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
{{ message }}
Repository navigation
The cloning process can be interrupted due to unstable network condition and cannot be resumed. #7440
The cloning process can be interrupted due to unstable network condition and cannot be resumed.
This happens a lot when we are trying to clone (download) a large project (e.g., over 100 MB) to local disk. The transmission speed initially is high, but gradually will become very low -- and usually there will be a point when the entire process stuck and then the program will throw an error -- and then the whole cloning process must be restarted, with all the previously downloaded data lost. The rate of failure increases drastically with the size of the project.
Is there a way to ensure the process be automatically resumed from the point of interruption even though we are downloading large project in an unstable network environment?
@takayamayukiko Thank you for making the suggestion! This sounds like a reasonable idea although there may be some underlying technical challenges I am not aware of, so I will let this sit for a few days to let other team members weigh in.
Is there a way to ensure the process be automatically resumed from the point of interruption even though we are downloading large project in an unstable network environment?
Git itself doesn't support resuming after a failed clone, and for the moment I'd recommend this alternative workflow as a workaround:
# create an empty repository locally and move into it
$ git init some-repository
$ cd some-repository
# add the remote to be able to then try and fetch objects/refs
$ git remote add origin [some-url]
# this might fail, but you can retry this again and again until it downloads all the refs
$ git fetch origin
# checkout the default branch
$ git reset origin/master --hard
# ensure you are tracking the remote branch
$ git branch -u origin/master
Because of the number of manual steps here, we don't have plans to support this in the app. I'll add a note into #926 which is our proposed workflow to support retrying a failed clone, which is underway as part of #7080.
Is there a way to ensure the process be automatically resumed from the point of interruption even though we are downloading large project in an unstable network environment?
Git itself doesn't support resuming after a failed clone, and for the moment I'd recommend this alternative workflow as a workaround:
# create an empty repository locally and move into it
$ git init some-repository
$ cd some-repository
# add the remote to be able to then try and fetch objects/refs
$ git remote add origin [some-url]
# this might fail, but you can retry this again and again until it downloads all the refs
$ git fetch origin
# checkout the default branch
$ git reset origin/master --hard
# ensure you are tracking the remote branch
$ git branch -u origin/master
Because of the number of manual steps here, we don't have plans to support this in the app. I'll add a note into #926 which is our proposed workflow to support retrying a failed clone, which is underway as part of #7080.
yeah this doesn't work.
git fetches can't be resumed.
I can only imagine how many people around the world with bad internet connections absolutely cannot use git at all.
I can only imagine how many people around the world with bad internet connections absolutely cannot use git at all.
You're right. Whoever designed git this way is an idiot.
Here's how I'm working around the problem for an initial clone of a large repository:
> git clone https://github.com/big-co/big-repo.git --depth 50
> cd big-repo/
# Repeat this as necessary with a different number
> git fetch --depth 1500
> git fetch --unshallow
The key is what to use instead of 1500 for your repo, which you can only figure out by trying different numbers. Try it with a very large number at first, to see how many objects it tries to download, say 1 million. Then keep lowering the depth number, which is completely different than the number of objects, till you get the number of objects down to 100k or whatever you feel comfortable with over your network.
Keep downloading the repo in batches like that till you get close to the end and finish with the unshallow step to get the last batch.
That appears to get most everything, but no idea if there's still something missing. Apparently, replacing the first step above with git clone https://github.com/big-co/big-repo.git --depth 50 -b main --no-single-branch, where main is the name of your trunk branch you get by default anyway, would've avoided the need for the last two steps to get the remaining branches.
Yes, that is exactly what the above command is doing, though you may want to use the --deepen flag instead of --depth. Of course, downloading any particular chunk of commits can still fail.
No, the clone command remains the same as above, but I'm not clear if git fetch --depth 1500 gets new commits each time it's run, or simply gets the same commits over and over again. git fetch --deepen 1500 definitely gets new commits each time- it's how I just downloaded a large 3-4 GiB repo 500 MiB at a time- but only on the main branch, so the final --unshallow will get all the other branches, assuming you passed --no-single-branch to the initial clone.
Activity
tierninho commentedon May 1, 2019
@takayamayukiko Thank you for making the suggestion! This sounds like a reasonable idea although there may be some underlying technical challenges I am not aware of, so I will let this sit for a few days to let other team members weigh in.
shiftkey commentedon May 6, 2019
Git itself doesn't support resuming after a failed clone, and for the moment I'd recommend this alternative workflow as a workaround:
Because of the number of manual steps here, we don't have plans to support this in the app. I'll add a note into #926 which is our proposed workflow to support retrying a failed clone, which is underway as part of #7080.
zackees commentedon Nov 27, 2024
yeah this doesn't work.
git fetches can't be resumed.
I can only imagine how many people around the world with bad internet connections absolutely cannot use git at all.
finagolfin commentedon Dec 22, 2024
You're right. Whoever designed git this way is an idiot.
Here's how I'm working around the problem for an initial clone of a large repository:
The key is what to use instead of 1500 for your repo, which you can only figure out by trying different numbers. Try it with a very large number at first, to see how many objects it tries to download, say 1 million. Then keep lowering the depth number, which is completely different than the number of objects, till you get the number of objects down to 100k or whatever you feel comfortable with over your network.
Keep downloading the repo in batches like that till you get close to the end and finish with the unshallow step to get the last batch.
finagolfin commentedon Dec 22, 2024
Turns out that only gets a single branch and not all the tags, I had to do more to get those:
That appears to get most everything, but no idea if there's still something missing. Apparently, replacing the first step above with
git clone https://github.com/big-co/big-repo.git --depth 50 -b main --no-single-branch, wheremainis the name of your trunk branch you get by default anyway, would've avoided the need for the last two steps to get the remaining branches.zackees commentedon Dec 23, 2024
Well here's the thing, it's still all or nothing.
What would be awesome is if we could fetch the history in parts, say the first 10 commits, then the next 10 commits... repeat.
This doesn't seem to be possible yet.
finagolfin commentedon Dec 23, 2024
Yes, that is exactly what the above command is doing, though you may want to use the
--deepenflag instead of--depth. Of course, downloading any particular chunk of commits can still fail.zackees commentedon Dec 23, 2024
So something like this?
git clone https://github.com/big-co/big-repo.git --deepen 50finagolfin commentedon Dec 24, 2024
No, the clone command remains the same as above, but I'm not clear if
git fetch --depth 1500gets new commits each time it's run, or simply gets the same commits over and over again.git fetch --deepen 1500definitely gets new commits each time- it's how I just downloaded a large 3-4 GiB repo 500 MiB at a time- but only on the main branch, so the final--unshallowwill get all the other branches, assuming you passed--no-single-branchto the initial clone.