usethis
usethis copied to clipboard
`use_github()` fails with "Repo already exists" after renaming a repo
If I create a repo on GitHub, then rename it and then try to use use_github()
with the old name, it errors with "Repo [reponame] already exists on 'github.com'"
, even though that name should be now be available after the renaming.
To reproduce:
On GitHub:
- Create a repo (called for example "test123")
- Rename the repo to "test123.old"
Locally:
-
create_project("~/Desktop/test123")
-
use_git()
(accept all the prompts) -
use_github()
- this gives:ℹ Defaulting to 'https' Git protocol ✔ Setting active project to '/Users/andy/dev/test123' Error: Repo 'ateucher/test123' already exists on 'github.com'
This occurs because of the redirect that GitHub does on renamed repos, so the API call in check_no_github_repo()
here does not fail because it finds the renamed repo (test123.old
).