Skip to content

Fail early if user tries to use SSH but SSH is not enabled #144

@jdblischak

Description

@jdblischak

Git allows users to authenticate via a traditional username and password (HTTPS) or SSH keys. The workflowr package also supports SSH keys via git2r/libgit2, but only if it is properly enabled during installation of git2r/libgit2. Instead of waiting for a failure, it would be better if workflowr could catch the error early if it is obvious it will fail.

The protocol that the user is using for authentication is determined for wflow_git_push() in the code below:

https://github.com/jdblischak/workflowr/blob/2bfc2199b949ba608691aff9dfd9d252582f69cf/R/wflow_git_push.R#L140-L149

If protocol == "ssh" and git2r::libgit2_features() returns FALSE, the function throw an error that SSH authentication is not supported, and advise the user to re-install git2r to enable this.

If you'd like to work on this, please volunteer below. Thanks in advance!

Steps:

  • Fork and clone workflowr repository
  • Checkout the dev branch with "git checkout dev"
  • Open the file R/wflow_git_push.R
  • After the protocol (HTTPS or SSH) has been determined (lines 140-149), use the git2r function git2r::libgit2_features() to check if SSH is supported. If the user is trying to use SSH when it isn't supported by the current installation, throw an informative error message with stop().
  • Repeat the previous step for wflow_git_pull()
  • Push to GitHub and submit Pull Request

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions