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

Does Git-Clone support Personal access tokens ? #1256

Closed
lbrader opened this issue Jan 27, 2016 · 1 comment
Closed

Does Git-Clone support Personal access tokens ? #1256

lbrader opened this issue Jan 27, 2016 · 1 comment

Comments

@lbrader
Copy link

lbrader commented Jan 27, 2016

I'm trying to clone a private repository. But I have 2 phase authorization in place. In Octokit I have been using tokens with no issues.

Is there a way to use tokens with libgit2sharp?

thanks

@lbrader lbrader changed the title Does Git-Clone support Personal access tokens Does Git-Clone support Personal access tokens ? Jan 27, 2016
@shiftkey
Copy link
Contributor

Paraphrasing this stackoverflow question:

var co = new CloneOptions();
co.CredentialsProvider = (_url, _user, _cred) => 
    new UsernamePasswordCredentials
    {
        Username = "the-access-token", // YOUR TOKEN HERE
        Password = string.Empty
    };
Repository.Clone("https://github.com/libgit2/libgit2sharp.git", "path/to/repo", co);

Note: this is specific to GitHub

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