Cannot push to github on an already created repository

I'm trying to have a blog using blogdown, on my Windows 10 machine.

I've already an empty repository called : 'omargonzalesdiaz' (no readme file) on Github.

I've created a blog using blogdown that I want to publish to Github, so later I can use netlify.

But I get this error:

cred <- git2r::cred_ssh_key(
+     publickey = "~/../.ssh/id_rsa.pub",
+     privatekey = "~/../.ssh/id_rsa"
+ )
> usethis::use_github(credentials = cred)
✔ Checking that current branch is 'master'
Error: Repo 'OmarGonD/omargonzalesdiaz' already exists on 'github.com'.

Infomation about my configuration

:

> usethis::git_sitrep()
Git user
* Name: 'OmarGonD'
* Email: 'oma.gonzales@gmail.com'
* Vaccinated: TRUE
usethis + git2r
* Default usethis protocol: <unset>
* git2r supports SSH: TRUE
* Credentials: '<usethis + git2r default behaviour>'
GitHub
* Personal access token: '<found in env var>'
* User: 'OmarGonD'
* Name: 'omar'
Repo
* Path: 'D:/omargonzalesdiaz/.git'
* Local branch -> remote tracking branch: 'master' -> '<unset>'
GitHub pull request readiness
* origin: OmarGonD/omargonzalesdiaz, can push
* upstream: '<no such remote>'

Environ file:

Entered and save when cursor was in a new line, as documentation said.

usethis::edit_r_environ()

GITHUB_PAT=ca44fcabcf29ce76a9999364f27771063dacd3da

While I've never used usethis::use_github() :grinning:, my impression from the documentation is that the function is supposed to create a GitHub repository for you. Given that, it seems possible that already having a repo with the same name could be problematic and the cause of the error message.

Have you tried deleting the empty repo you made on GitHub and letting use_github() make it instead?

2 Likes

Yes, I think the same. 2 Questions:

a) Can I delete my repository and create other with the same name?
b) Maybe someone can point us on how to use this library on already created repositories?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.