Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

use_pkgdown_github_pages() gives Error: Internal error: Unexpected GitHub remote configuration: 'theirs' #1588

Closed
billdenney opened this issue Feb 25, 2022 · 5 comments

Comments

@billdenney
Copy link

When trying to do usethis::use_pkgdown_github_pages(), as suggested at https://pkgdown.r-lib.org/articles/pkgdown.html, I got an error noted below. I don't know of a good way to make a reprex for this, so I will try to give all the information that I can to indicate what I've done with the hopes that it is close to a reprex.

My goal is to add a pkgdown site to the nlmixr2 package. The steps I took were:

I'm running R 4.1.2 on Windows 10. I already had the nlmixr2 library cloned to my local hard drive and I have a branch for the origin and my fork.

  1. Load R
  2. Run usethis::use_pkgdown() to add pkgdown to the package.
    1. It asked me to install pkgdown which I did from source to version 2.0.2.
  3. Run usethis::use_pkgdown_github_pages(), and it gave the error below
> usethis::use_pkgdown_github_pages()
Error: Internal error: Unexpected GitHub remote configuration: 'theirs'
> traceback()
5: stop(cnd)
4: ui_stop("\n    Internal error: Unexpected GitHub remote configuration: {ui_value(cfg$type)}")
3: check_for_config(cfg)
2: target_repo(github_get = TRUE)
1: usethis::use_pkgdown_github_pages()

I then reran it after running options(error=recover), and I looked at the value of cfg in check_for_config(), and it was as follows:

Browse[2]> print(cfg)
Type = 'theirs'
Host = 'https://github.com'
Config supports a pull request = FALSE
origin = 'nlmixr2/nlmixr2' (can not push)
upstream = <not configured>
Desc = The only configured GitHub remote is 'origin', which
you cannot push to.
If your goal is to make a pull request, you must fork-and-clone.
`usethis::create_from_github()` can do this.

Read more about the GitHub remote configurations that usethis supports at:
'https://happygitwithr.com/common-remote-setups.html'

My guess about the issue is that I don't think that I can write directly to the origin/main branch, and I've not yet switched to my fork where I can write.

@billdenney
Copy link
Author

Update: I tried branching and switching to my fork as the tracked remote, but I had the same result.

@malcolmbarrett
Copy link
Collaborator

malcolmbarrett commented Feb 25, 2022

Jenny may have a suggestion, but use_pkgdown_github_pages() configures the actual repo settings. If you don't have access to do that, it seems natural that it wouldn't work.

@billdenney
Copy link
Author

@malcolmbarrett , thanks for that info. I probably don't have sufficient access to make changes on GitHub to that repo. I suppose that the request here would be to make the error clearer, then.

@jennybc
Copy link
Member

jennybc commented Feb 25, 2022

You won't be able to turn on GitHub Pages for a repo you don't have push access to. Using the GitHub remote setup vocabulary used in usethis and Happy Git, this requires the setup be recognized as "ours" or (in some cases, perhaps) "fork".

https://happygitwithr.com/common-remote-setups.html

@billdenney I see you say this:

Update: I tried branching and switching to my fork as the tracked remote, but I had the same result.

but I am not sure exactly what you mean by "branching and switching to my fork" and whether that gets you into a clearly recognized and supported GitHub setup.

This does feel like just a bad error message, i.e. we can't succeed here and we need to say that more clearly.

@billdenney
Copy link
Author

@jennybc , Thanks! The explanation makes sense.

Fair that I wasn't clear when I said "branching and switching to my fork". What I did was I created a new git branch and checked it out. Then I set my fork of the repo (where I do have push access) as the tracked branch. After that, I still got the same message. In reality, I'm not wanting to setup something on the GitHub side from that forked repo, so I think that still shouldn't work (or perhaps it should give an error unless there is a specific opt-in choice made).

@jennybc , I think that your comment inspires a good error message: "use_pkgdown_github_pages() only works for repositories where you have push access".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants