Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

create_from_github() should wait a few seconds before trying to clone after forking #1755

Closed
DavisVaughan opened this issue Jan 27, 2023 · 3 comments · Fixed by #1756
Closed
Labels
git git, GitHub, and CI in general

Comments

@DavisVaughan
Copy link
Member

I consistently get this issue when I use create_from_github() the first time.

> usethis::create_from_github("mpallocc/auto-go", "~/Desktop/r/playground/packages/")
✔ Setting `fork = TRUE`Creating '/Users/davis/Desktop/r/playground/packages/auto-go/'Forking 'mpallocc/auto-go'Cloning repo from 'git@github.com:DavisVaughan/auto-go.git' into '/Users/davis/Desktop/r/playground/packages/auto-go'
Error in libgit2::git_clone : 
  remote error: access denied or repository not exported: /1/nw/1d/b2/2d/439104554/594071937.git

It always works the second time.

I asked Jeroen and he said it takes a few seconds for a new repo to become clonable.

He pauses for 10 seconds in r-universe code here:
https://github.com/r-universe-org/setup-universes/blob/712f956acd73f878a0df0a4c8e0cb657019831e5/R/setup.R#L94-L100

I vote we do something similar, maybe pausing for 5 seconds and seeing if that is enough? Probably would be good to also notify the user that we are pausing for a second to let the repo become clonable.

@jennybc
Copy link
Member

jennybc commented Jan 27, 2023

We have Sys.sleep() in various GitHub-y functions and others have come and gone, as necessary. So, yes, this is a phenomenon usethis has some history with.

I consistently get this issue when I use create_from_github() the first time.

As for that, I think it's because the first attempt creates the fork, so the second time, we aren't actually creating a fork. We send that request, but GitHub sees that you already have a fork and returns the info for that repo, which was already there and waiting.

I'm hesitant to reflexively add a 5 or 10 second wait here. Have you been seeing this for a long time and consistently? I think it would be better to have a shorter wait or to handle with some sort of retry.

@malcolmbarrett
Copy link
Collaborator

malcolmbarrett commented Jan 27, 2023

I never thought much of this, as it doesn't happen to me often, but I've seen this, too. A shaky recollection of when seems to match this pattern. Could we instead look for this specific error and then delay retry? EDIT: ope, this is already in Jenny's comment

@jennybc jennybc added the git git, GitHub, and CI in general label Jan 27, 2023
@DavisVaughan
Copy link
Member Author

It has only started happening in the last week or so, but is very consistent now

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
git git, GitHub, and CI in general
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants