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_github for a non-package project fails #2096

Closed
merliseclyde opened this issue Jan 30, 2025 · 2 comments
Closed

use_github for a non-package project fails #2096

merliseclyde opened this issue Jan 30, 2025 · 2 comments

Comments

@merliseclyde
Copy link

I created a new project (via R-studio) and initiated it as a git repo use usethis::use_git(), followed by usethis::use_github
which failed with the following error

# repress
usethis::use_git()  ## successful
usethis::use_github()
Error in `check_no_github_repo()`:Repo "merliseclyde/BAS" already exists on "github.com".
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/usethis_error>
Error in `check_no_github_repo()`:Repo "merliseclyde/BAS" already exists on "github.com".
---
Backtrace:1. └─usethis::use_github()
 2.   └─usethis:::check_no_github_repo(owner, repo_name, host)
Run rlang::last_trace(drop = FALSE) to see 3 hidden frames.

The issue seems to arise in the call to usethis:::project_name() which thinks that the project is a package (returns TRUE) and ultimately calls desc::desc()```

If this is also intended for non-package projects, I would expect project name to return the directory name, rather than another
package...

usethis:::project_name()
"BAS"

desc::desc()
Package: BAS
Title: Bayesian Variable Selection and Model Averaging using
    Bayesian Adaptive Sampling
Version: 1.7.5.9000
Date: 2025-01-14
Authors@R (parsed):
    * Merlise Clyde <clyde@duke.edu> [aut, cre, cph] (ORCID=0000-0002-3595-1872)
    * Michael Littman [ctb]
@jennybc
Copy link
Member

jennybc commented Jan 31, 2025

The error reported is this:

Error in `check_no_github_repo()`:
✖ Repo "merliseclyde/BAS" already exists on "github.com".

And that repo does indeed already exist on GitHub:
https://github.com/merliseclyde/BAS

So that is the problem. use_github() is for creating a companion repo on GitHub, but usethis can't do so if the user already has a repo by that same name.

@jennybc jennybc closed this as completed Jan 31, 2025
@merliseclyde
Copy link
Author

merliseclyde commented Feb 2, 2025

Agreed that there is a repo by that name on GitHub and locally, but the directory name for this project is not BAS, nor is this in the BAS subdirectory, (I expected the new repo to be called the current directory). The current directory does not correspond to a Github repo, so it is not clear to me how my BAS repo was selected in the code as I have other repos (both packages and websites).

What is weird is that this seems to only occur in arbitrary directories that are stored on iCloud (when use_github is called from any directory that I have tested in iCloud it finds the BAS description (at a lower level), but when run on other file partitions ``use_github``` works as expected. (in my initial example the directory I was testing and the dir for BAS are in the same directory.

The issue seems to be in the desc::desc() function run from directories in iCloud returns the package description from BAS, but in other partitions desc::desc returns the expected result

> desc::desc()
Error in find_package_root(dir) : 
  Could not find R package in `.` or its parent directories.

In anywise a weird interaction!

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

2 participants