rust-lang / rust-lang/git2-rs

[feat] Implement Login to GitHub with 2FA Support

Open
#1,083 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.1k
Forks
450
Avg merge
11m
Merged PRs (30d)
1

Description

I'm attempting to clone a private GitHub repository via HTTPS, as mandated by my work requirements. However, I'm encountering difficulties with the login process.

I have attempted to use Cred::userpass_plaintext as a credential callback to provide my username and password, but I've realized that this approach doesn't work when two-factor authentication (2FA) is enabled on the GitHub account.
Given this scenario, I need to find an alternative method to authenticate and clone the private repository, while still adhering to the HTTPS protocol. Are there any recommended practices or solutions that can help me achieve this, considering the 2FA requirement?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Cred::userpass_plaintext callback and the HTTPS cloning flow described in the issue. Investigate GitHub's supported authentication approach for accounts with 2FA and whether git2-rs exposes it. Done means a supported alternative is identified and implemented or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github, rust
Domain
authentication
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.