user2853834
user2853834

Reputation:

git push failed via personal access token authentication in android studio

I tried reading several solves regarding ssh server key but couldn't grab the idea. This is my first push to git repository so I will ask to keep the solution as simple as possible.

First I tried git push directly from Android Studio VCS. But having 2-factor authentication enabled it didn't work and showed error like authentication failed.

Then I generated Personal Access Token and add origin like this-

git remote -v 
git remote remove origin 
git remote add origin [email protected]:user/repo.git  

Now while trying to git push, it tried to connect with SSH server key but failed.

Upvotes: 1

Views: 4468

Answers (1)

Matthias T
Matthias T

Reputation: 1300

Had the same issue when pushing from Android Studio with two-factor-verification enabled. As stated here I generated a personal access token. This is described in more detail here. In essence you need to:

  1. Go to your GitHub settings.
  2. Click Personal access tokens (down to the bottom).
  3. Generate a new Access token with the scope "public_repo"
  4. Save the generated public access token in a password manager of your choice
  5. Enter the personal access token when prompted for the password (!) by Android studio.

Upvotes: 5

Related Questions