EVOLUTION-MANAGER
Edit File: gh_whoami.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Info on current GitHub user and token</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for gh_whoami {gh}"><tr><td>gh_whoami {gh}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Info on current GitHub user and token</h2> <h3>Description</h3> <p>Reports wallet name, GitHub login, and GitHub URL for the current authenticated user, the first bit of the token, and the associated scopes. </p> <h3>Usage</h3> <pre> gh_whoami(.token = NULL, .api_url = NULL, .send_headers = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>.token</code></td> <td> <p>Authentication token. Defaults to <code>GITHUB_PAT</code> or <code>GITHUB_TOKEN</code> environment variables, in this order if any is set. See <code><a href="gh_token.html">gh_token()</a></code> if you need more flexibility, e.g. different tokens for different GitHub Enterprise deployments.</p> </td></tr> <tr valign="top"><td><code>.api_url</code></td> <td> <p>Github API url (default: <a href="https://api.github.com">https://api.github.com</a>). Used if <code>endpoint</code> just contains a path. Defaults to <code>GITHUB_API_URL</code> environment variable if set.</p> </td></tr> <tr valign="top"><td><code>.send_headers</code></td> <td> <p>Named character vector of header field values (except <code>Authorization</code>, which is handled via <code>.token</code>). This can be used to override or augment the default <code>User-Agent</code> header: <code>"https://github.com/r-lib/gh"</code>.</p> </td></tr> </table> <h3>Details</h3> <p>Get a personal access token for the GitHub API from <a href="https://github.com/settings/tokens">https://github.com/settings/tokens</a> and select the scopes necessary for your planned tasks. The <code>repo</code> scope, for example, is one many are likely to need. </p> <p>On macOS and Windows it is best to store the token in the git credential store, where most GitHub clients, including gh, can access it. You can use the gitcreds package to add your token to the credential store: </p> <div class="sourceCode r"><pre>gitcreds::gitcreds_set() </pre></div> <p>See <a href="https://gh.r-lib.org/articles/managing-personal-access-tokens.html">https://gh.r-lib.org/articles/managing-personal-access-tokens.html</a> and <a href="https://usethis.r-lib.org/articles/articles/git-credentials.html">https://usethis.r-lib.org/articles/articles/git-credentials.html</a> for more about managing GitHub (and generic git) credentials. </p> <p>On other systems, including Linux, the git credential store is typically not as convenient, and you might want to store your token in the <code>GITHUB_PAT</code> environment variable, which you can set in your <code>.Renviron</code> file. </p> <h3>Value</h3> <p>A <code>gh_response</code> object, which is also a <code>list</code>. </p> <h3>Examples</h3> <pre> gh_whoami() ## explicit token + use with GitHub Enterprise gh_whoami( .token = "8c70fd8419398999c9ac5bacf3192882193cadf2", .api_url = "https://github.foobar.edu/api/v3" ) </pre> <hr /><div style="text-align: center;">[Package <em>gh</em> version 1.3.1 <a href="00Index.html">Index</a>]</div> </body></html>