870

Whenever I try to push into my repo git asks for both username & password.

I have no problem in re-entering my password each time but the problem is in entering username. I use https to clone my repository.

So, how can I configure git so that it doesn't asks for username on each git push.

I am new to linux but IIRC in windows git push only asks for password.

Ulrich Eckhardt
  • 16,572
  • 3
  • 28
  • 55
RanRag
  • 48,359
  • 38
  • 114
  • 167
  • 1
    Related question: http://stackoverflow.com/questions/2233590/is-there-a-way-to-make-git-remember-the-password-for-webdav-remotes – Wug Jul 09 '12 at 21:31
  • @Wug: But I don't want to store password. I only want to store the username. – RanRag Jul 09 '12 at 21:33
  • 4
    try following those directions and omitting the password line. – Wug Jul 09 '12 at 21:35
  • 2
    possible duplicate of [Is there a way to skip password typing when using https:// github](http://stackoverflow.com/questions/5343068/is-there-a-way-to-skip-password-typing-when-using-https-github) – dk14 Jan 31 '15 at 21:45
  • there is also an answer on superuser to your initial question - http://superuser.com/questions/847181/skip-username-prompt-when-using-git – dk14 Jan 31 '15 at 22:32
  • If you just want to save your username it's super easy, just do this: https://help.github.com/articles/setting-your-username-in-git/ – Jim In Texas Sep 17 '15 at 21:22
  • Same question here, linked the answer which worked for me : https://stackoverflow.com/a/35942890/1579667 – Benj Jul 07 '17 at 08:56
  • Possible duplicate of [Git push requires username and password](https://stackoverflow.com/questions/6565357/git-push-requires-username-and-password) – 123survesh Mar 11 '19 at 06:29
  • In my case, this was occurring because I pushing to a GitHub wiki. – Dylan Landry May 09 '20 at 18:47
  • I had created an article sometime back, for a step by step ssh configuration in git. Check it out once. https://medium.com/@divygupta0319/configuring-ssh-key-in-windows-and-ubuntu-part-1-d1bf989ae698 – Divya Gupta Feb 08 '22 at 06:31

31 Answers31

1193

Edit (by @dk14 as suggested by moderators and comments)

WARNING: If you use credential.helper store from the answer, your password is going to be stored completely unencrypted ("as is") at ~/.git-credentials. Please consult the comments section below or the answers from the "Linked" section, especially if your employer has zero tolerance for security issues.

Even though accepted, it doesn't answer the actual OP's question about omitting a username only (not password). For the readers with that exact problem @grawity's answer might come in handy.


Original answer (by @Alexander Zhu):

You can store your credentials using the following command

$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>

Also I suggest you to read
$ git help credentials

dk14
  • 22,206
  • 4
  • 51
  • 88
Alexander Zhugastrov
  • 12,678
  • 2
  • 20
  • 22
  • 204
    Warning, there is no security in this method. Your password is stored as plaintext. – Mark Lakata Feb 04 '15 at 22:32
  • 14
    you can find better ways to achieve security here - http://stackoverflow.com/a/28104587/1809978 – dk14 Feb 15 '15 at 21:31
  • Will other people working on the same repository see my username? – CodyBugstein Mar 18 '15 at 09:51
  • 8
    @MarkLakata - Please tell me how I can undo the command in this answer ? After I undo it, I'll use a secure method to store the credentials. – MasterJoe Sep 16 '16 at 17:04
  • this works thanks. how long will it remember the credentials without asking the password again? can I change the time? – Harlan Gray Oct 03 '16 at 05:25
  • 34
    @testerjoe2 try `git config --unset credential.helper` – dk14 Oct 22 '16 at 07:19
  • 1
    Don't forget to set the timeout, default is 15min - Set the value to 30 million to have about 1 year. Found here : stackoverflow.com/a/35942890/1579667 – Benj Jul 07 '17 at 08:58
  • I had this problem but was also getting an error attempting to save credentials to the secure store. To fix it I had to stop Eclipse and remove the ~/.eclipse/org.eclipse.equinox.security directory where the secure_store file is located, then following directions, set up a password file in ~/.eclipse (just text file with password) and added these lines at the beginning of eclipse.ini: -eclipse.password /Users/xxxx/.eclipse/eclipse.txt This enabled storing the git password and I no longer have to reenter my user id and password when pushing to git. – wnm3 Oct 17 '17 at 16:03
  • If storing plaintext passwords is a problem, and assuming it's for github, you can authenticate with a token instead of a password, then at least only the token will be stored in plain text, and it can be revoked at any time: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ – user3432422 Aug 30 '18 at 07:59
  • 1
    "@grawity's answer might come in handy." It looks to be specific to one repo. The ability to never have to enter your username (but still enter your password) when using `git push` would be preferable, rather than setting for each repository. – James Ray Oct 17 '19 at 01:07
  • `git config --global credential.helper store` actually seems OK for me as my computer is encrypted. – James Ray Oct 17 '19 at 01:14
  • How to input the username and password automatically? I want to combine this with some other shell command, let the user/password auto be setted, but I failed. I want some automation. – gfan Dec 13 '21 at 08:55
  • grawity user changed his name? @dk14 – Smart Manoj Apr 30 '22 at 08:40
  • I’ve edited the link to point to exact answer to avoid potential confusion in the future (ex-grawity’s answer is most top-voted at the moment). Anyways, with the link to the relevant answer present I do not think it matters wether I keep the nickname updated or mention it at all. Although I’d keep the name to make it feel more human, but feel free to edit if it bothers you :). You could also propose a community bot to correct nickname references automatically. – dk14 May 01 '22 at 09:36
  • git config credential.helper cache is a good enough compromise, no permanent storage, less repetition - https://git-scm.com/docs/gitcredentials – chrismarx Apr 29 '23 at 15:42
230

You can accomplish this in the .git/config file of your local repository. This file contains a section called 'remote' with an entry called 'url'. The 'url' entry should contains the https link of repository you're talking about.

When you prefix the host 'url' with your username, git shouldn't be asking for your username anymore. Here's an example:

url = https://username@repository-url.com
MERose
  • 4,048
  • 7
  • 53
  • 79
  • 7
    If you use special characters in your user name or pw then you should escape them. See http://en.wikipedia.org/wiki/Percent-escape for the right escape characters. for example "!@#" [without the quotations] would be replaced by "%21%40%23". See also "Daniel Lerch" answer below – nsof Aug 10 '14 at 09:36
  • 1
    Will other people working on the same repository see my username? – CodyBugstein Mar 18 '15 at 09:51
  • 23
    This should be the correct answer to the OP's question, i.e. "how to persist username, NOT password". Not only is this answer the proper way to persist username, it also avoids the possible security risk of `git config credential.helper store`. – RayLuo Oct 21 '16 at 00:17
  • I'm thankfull for this answer and tried this way, but it still askes me every time (v 2.1.4) - tried the remoteurl with name@gitlab.com AND name%40mailaddress.com@gitlab.com - it always asks for `username for https://gitlab.com:` – MacMartin Dec 27 '16 at 10:02
  • I tried this and had the following error: `ssh: Could not resolve hostname https: No address associated with hostname` `fatal: Could not read from remote repository.` `Please make sure you have the correct access rights and the repository exists.` Are you sure that your example is correct? – Zoey Hewll Mar 04 '17 at 07:06
  • 1
    I tried this and got `unable to access 'https://@bitbucket.org:/.git/': Illegal port number` – Ian Grainger Aug 02 '17 at 09:08
  • Note: This hasn't working for me until I have edited URL from `https://username@gitlab-url/project-name/` to `https://username@gitlab-url/project-name.git` (url ends on `.git` ). Not sure why but this helped – Marek F Nov 09 '20 at 14:02
155

Add new SSH keys as described in this article on GitHub.

If Git still asks you for username & password, try changing https://github.com/ to git@github.com: in remote URL:

$ git config remote.origin.url 
https://github.com/dir/repo.git

$ git config remote.origin.url "git@github.com:dir/repo.git"
Lukasz Czerwinski
  • 13,499
  • 10
  • 55
  • 65
  • 31
    This should be the right answer! Saving your credential is incredibly non secure. If I have an SSH key in place, it's asking me my credential only because I don't have the correct URL as outlined here. – Alexis Wilke Jun 11 '18 at 02:27
  • 7
    or you can use `git config remote.origin.url "ssh://git@yourRepoHost/yourRepoName.git"` – ndarkness Nov 02 '18 at 13:46
  • 2
    git config remote.origin.url git@gitlab.com:adammajewski/ray-backward-iteration.git – Adam Feb 21 '19 at 17:37
  • I have to remember to clone using the SSH URL instead of the HTTP one. Saves an extra step. – Allan Dec 20 '20 at 23:03
  • The `git@github` URL worked but I also had to create a Personal Access Token and SSH Key to get my authentication working – Dani Amsalem Nov 10 '21 at 16:44
  • this doesn't work if your ssh key has a passphrase – Rainb Feb 07 '23 at 11:49
145

Permanently authenticating with Git repositories

Run following command to enable credential caching:

$ git config credential.helper store
$ git push https://github.com/repo.git

Username for 'https://github.com': <USERNAME>
Password for 'https://USERNAME@github.com': <PASSWORD>

Use should also specify caching expire

git config --global credential.helper "cache --timeout 7200"

After enabling credential caching, it will be cached for 7200 seconds (2 hour).


Read credentials Docs

$ git help credentials
Community
  • 1
  • 1
Jaykumar Patel
  • 26,836
  • 12
  • 74
  • 76
  • I set timeout to 7200. But then I thought to set it to 5 for testing. So I set it to 5, but then when I tried to push again after 30 seconds, but I was not asked for username or password. – Buttle Butkus Jan 07 '16 at 00:01
  • May be your credential not store globally. – Jaykumar Patel Jan 07 '16 at 05:32
  • Regarding security, worth to refer the docs: "This command caches credentials in memory for use by future Git programs. The stored credentials never touch the disk, and are forgotten after a configurable timeout." https://git-scm.com/docs/git-credential-cache – mloskot Aug 03 '16 at 21:16
  • 4
    isn't the `git config credntial.helper store` that dangerous command, which is responsable for storing the plaintext-credentials in the ~/.git-credentials file? I think (and in my experience) the ...cache...-command is sufficient: `git config --clogal credential.helper 'cache --timeout 7200'` It creates the dir: `~/.git-credential-cache` with the cache-file in it So, just execute this command and NOT the "...store"-command – MacMartin Dec 28 '16 at 11:07
  • 4
    Didn't work for me. Still asking for password every time – Ian Grainger Aug 02 '17 at 09:11
70

The easiest way I found was with this command:

git config --global credential.https://github.com.username <your_username>

This works on a site by site basis and modifies your global git config.

To see the changes, use:

git config --global --edit
Ben
  • 5,952
  • 4
  • 33
  • 44
  • 1
    For some reason this was the only method that worked for me. Thanks! – mathetes Jun 08 '17 at 17:06
  • is this method secure? are github password only stored on local computer and not pushed to github? – Akin Hwan Apr 01 '18 at 02:06
  • 1
    I don't know why this isn't the approved answer, the command works perfectly and responds fully and only to the question : storing username, not password. Thanks Ben ! – Amael H. Jan 19 '19 at 21:36
  • You can also run: [ git config --global credential.helper 'cache --timeout=3600' ] So your password will be save for an hour each time – Oz Ben-David Apr 19 '20 at 12:53
  • This is the answer I was looking for. Thanks. I wanted to explicitly enter the password (so that I don't accidentally git push), but not username. – anishsane Jan 28 '21 at 08:12
  • Simple solution that works for multiple checkouts, love it. – BeyelerStudios Feb 14 '23 at 10:41
38

If you are using https instead of ssh, you can edit "url" in .git/config as user701648 says, but if you want you can add also the password:

url = https://username:password@repository-url.com
Cadoiz
  • 1,446
  • 21
  • 31
Daniel Lerch
  • 661
  • 7
  • 11
  • 1
    What if there `@` included in my password? `url = https://username:abc@123@repository-url.com` It's giving me error that `Could not resolve host: @123@git.com` – Rahul Mankar Jun 18 '18 at 11:43
  • The `username` part seems to be ignored, when the server redirects (such as from FOO to FOO.git). – Mikhail T. Aug 13 '18 at 16:40
  • @RahulMankar both username and password should be urlencoded (by e.g. encodeURIComponent() in a browser console) – user3125367 Dec 24 '22 at 00:38
  • @RahulMankar use `%40` for the `@` in the email. Such as: `url = https://name%40domain.com:password@repository-url.com` – DEner Mar 17 '23 at 11:59
29
git config --global credential.helper cache
Yousha Aleayoub
  • 4,532
  • 4
  • 53
  • 64
Kai Wang
  • 3,303
  • 1
  • 31
  • 27
26

You can set your username for all repositories at a given site by putting something like the following in your Git configuration file. You'll want to change "https://example.com" and "me" to the actual URL and your actual username.

[credential "https://example.com"]
    username = me

(This is directly from "git help credentials")

Alan De Smet
  • 1,699
  • 1
  • 16
  • 20
22

Changing the cloned repo works:

git remote set-url origin git@github.com:gitusername/projectname.git

Using cached credentials works, and setting the timeout period makes things less annoying. If you use the Windows credential helper, that should be the easiest method (especially if SSH is blocked).

Layer8Err
  • 239
  • 2
  • 5
  • This is a correct answer for GitHub (which the question is specifically asking...(not sure why you got downvoted). – Tim Groeneveld Nov 09 '17 at 05:53
  • Doing this broke my ability to push to GitHub at all: `git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.` I don't recommend this method. – sh37211 Aug 12 '22 at 03:27
13

Make sure that you are using SSH instead of http. Check this SO answer.

Community
  • 1
  • 1
gkris
  • 1,209
  • 3
  • 17
  • 44
  • 5
    But I had to use `http` because in my university `ssh` is blocked by the sys-admin department. – RanRag Jul 11 '12 at 07:22
  • Then perhaps this [link](http://stackoverflow.com/a/5343146/1322460) will help you. – gkris Jul 11 '12 at 07:35
  • There's an official GitHub help page on this now. What happened for me was I cloned one of my own repos before logging in so it didn't recognize me and defaulted to HTTPS I believe. https://help.github.com/articles/changing-a-remote-s-url/ – fIwJlxSzApHEZIl Sep 10 '18 at 13:43
12

In addition to user701648's answer, you can store your credentials in your home folder (global for all projects), instead of project folder using the following command

$ git config --global credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>
Cadoiz
  • 1,446
  • 21
  • 31
Yuvi
  • 419
  • 7
  • 12
11

The easiest way is to create a ~/.netrc file with the following contents:

machine github.com
login YOUR_GITHUB_USERNAME
password YOUR_GITHUB_PASSWORD

(as shown here: https://gist.github.com/ahoward/2885020)

You can even close up the permissions on this file so that no one can read your password by typing:

chmod 600 ~/.netrc
Simpler
  • 1,317
  • 2
  • 16
  • 31
10

When I only git pull, git pull origin xxx, git asks for both username & password.

git config credential.helper store

it works.

Languoguang
  • 2,166
  • 2
  • 10
  • 15
7

If you use SSH version, you will not have any problems with passwords.Only one time you generate SSH key, to tell git, that this pc will work with this github account and never ask me again about any access (for this pc).

How To Generate SSH for Github

Hazarapet Tunanyan
  • 2,809
  • 26
  • 30
7
  1. git config credential.helper store

  2. git push https://github.com/xxx.git

  3. Then enter your username and password.

  4. Done

Community
  • 1
  • 1
Stephen Tun Aung
  • 982
  • 9
  • 18
  • 1
    It's not `git push/push https://github.com/xxx.git` it should be `git push https://github.com/xxx.git` – Mohsin Aug 03 '18 at 12:51
6

Use personal access tokens not password:

Please note that, Beginning August 13, 2021, github will no longer accept account passwords when authenticating Git operations and will require the use of token-based authentication for all authenticated Git operations on GitHub.com. You may also continue using SSH keys where you prefer.

So for, static configuration of usernames for a given authentication context you have to use (when using github):

https://username:<personal-access-tokens>@repository-url.com

For example, to push to https://github.com/blueray453/window-application-calls , you have to run:

git push https://blueray453:<personal-access-token>@github.com/blueray453/window-application-calls

Please note that, we are using <personal-access-tokens> and not <password>

For further details on how to create a personal access token, please check the documentation. In summary, what the documentation says is, you have to go to https://github.com/settings/tokens and click on Generate new token (classic), there select public_repo for public repositories, or repo for private repositories. Then use that key as password.

Why only following three solutions:

github documentation says:

GitHub over HTTPS... Every time you use Git to authenticate with GitHub, you'll be prompted to enter your credentials to authenticate with GitHub, unless you cache them with a credential helper.

...

Using SSH ... Every time you use Git to authenticate with GitHub, you'll be prompted to enter your SSH key passphrase, unless you've stored the key.

github recommends Connecting over HTTPS. Probably because they want you to use Git Credential Manager. I have not used it, so will leave it for someone who has experience with it.

Here, I will only give Git and SSH solutions. Git's documentation discuss how to avoid inputting the same credentials over and over using gitcredentials.

Solution 1

Use credential helpers to cache password (in memory for a short period of time).

git config --global credential.helper cache

now run:

git push https://username:<personal-access-tokens>@repository-url.com

afterwards, only running git push will be enough.

Solution 2

Use credential helpers to store password (indefinitely on disk).

git config --global credential.helper 'store --file ~/.my-credentials'

You can find where the credential will be saved (If not set explicitly with --file) in the documentation.

now run:

git push https://username:<personal-access-tokens>@repository-url.com

afterwards, only running git push will be enough.

In this case the content of ~/.my-credentials will look like:

https://username:<personal-access-tokens>@repository-url.com

NOTE:

To address the concern that gitcredentials store the credentials completely unencrypted ("as is"), You can always encrypt the file and decrypt it before using.

Solution 3

This is almost a direct copy paste from Generating a new SSH key and adding it to the ssh-agent.

  1. Create the ssh key using ssh-keygen -t ed25519 -C "your_email@example.com". If you are using a legacy system that doesn't support the Ed25519 algorithm, use: ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

  2. Add the SSH key to your account on GitHub. After you generate an SSH key pair, you must add the public key to https://github.com/settings/ssh/new

  3. If not started, start the ssh-agent in the background using $ eval "$(ssh-agent -s)"

  4. Add your SSH private key to the ssh-agent using $ ssh-add ~/.ssh/id_ed25519. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.

  5. Test the SSH key: ssh -T git@github.com

  6. Change directory into the local clone of your repository (if you're not already there) and run: git remote set-url origin git@github.com:username/your-repository.git. Now, git push hopefully will work.

Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87
5

To avoid entering username, but still be prompted to enter a password, then you can simply clone your repository including the username:

git clone user_name@example.gitrepo.com/my_repo.git
ManoDestra
  • 6,325
  • 6
  • 26
  • 50
5

Quick method

get url of your git when inside working dir :

git config remote.origin.url

then :

git config credential.helper store

git push "url of your git"

will ask username and password last one time

done.

Community
  • 1
  • 1
Aominé
  • 472
  • 3
  • 11
5

ssh + key authentication is more reliable way than https + credential.helper

You can configure to use SSH instead of HTTPS for all the repositories as follows:

git config --global url.ssh://git@github.com/.insteadOf https://github.com/

url.<base>.insteadOf is documented here.

Akif
  • 6,018
  • 3
  • 41
  • 44
5

As of August 13, 2021 password-based logins are no longer accepted. You are now required to use token/SSH-based authentication.

If you don't want to be asked every time you push, install GitHub CLI, and then to cache your credentials:

git config --global credential.helper store
gh auth login   

And follow the prompts. But make sure you check Authenticate Git with your GitHub credentials? with Y.

ahmelq
  • 593
  • 7
  • 11
4

You can just run

git config --global credential.helper wincred

after installing and logging into GIT for windows in your system.

cyperpunk
  • 664
  • 7
  • 13
4

The proper way to solve it is to change the http to ssh.

You can use this git remote rm origin to remove your remote repo.

And then you can add it again with the ssh sintax (which you can copy from github): git remote add origin git@github.com:username/reponame.git .

Check this article. https://www.freecodecamp.org/news/how-to-fix-git-always-asking-for-user-credentials/

  • Ummm - no. That's a possibility, not "the proper way". Also check the OPs comment in [this answer](https://stackoverflow.com/a/11411253/1394729) (which is quite similar to yours, btw). – tink Dec 06 '20 at 23:52
3

(Only For Mac OS)

for Windows and Linux please refer to Github's documentation link mentioned below.

From Github Documentation: Documentation Link

Caching your GitHub password in Git

  • You need Git 1.7.10 or newer to use the osxkeychain credential helper.

    to check your Git version: git --version

  • to find out osxkeychain helper is already installed:

    git credential-osxkeychain

    if you get following response then you have it already installed and ready to use on your mac:

    > Usage: git credential-osxkeychain <get|store|erase>

    if you don't get a response as shown above then you can install it running following command:

    git credential-osxkeychain

  • to tell git to globally use osxkeychain for git credentials:

    git config --global credential.helper osxkeychain

    It will prompt once before it saves credentials to the keychain.

Akash Gandhi
  • 61
  • 1
  • 9
3

To set the credentials for the entire day that is 24 hours.

git config --global credential.helper 'cache --timeout=86400'

Else for 1 hour replace the 86400 secs to 3600.

OR

all configuration options for the 'cache' authentication helper:

git help credential-cache

for more information: https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git

champion-runner
  • 1,489
  • 1
  • 13
  • 26
3

I use to store my Git Repository Username and Password on Disk. So git doesn't ask for username and password every time while I push my code

follow these commands to save credentials in the local storage

$ git config credential.helper store
or
$ git config --global credential.helper store

From now on, Git will write credentials to the ~/.git-credentials file for each URL context, when accessed for the first time. To view the content of this file, you can use the cat command as shown.

$ cat  ~/.git-credentials
Gunjan Paul
  • 511
  • 6
  • 12
2

Use the following command can give you a 15 minutes to timeout.

$ git config --global credential.helper cache

You can also modify the time by the command below. This is an example for 1 hours.

$ git config --global credential.helper 'cache --timeout=3600'

If you would like to cache locally, use the command for an hour to timeout.

$ git config credential.helper 'cache --timeout=3600'
chenghuayang
  • 1,424
  • 1
  • 17
  • 35
1

For me this issue appeared when I enabled 2-Factor Authentication (2FA) for my account. I would enter correct credentials and authentication would still fail because of course the terminal authentication does not ask for authentication code.

I simply had to disable 2FA for my account. Upon doing that I had to enter my credentials just one time during git push. They weren't required from then on.

Bikramjeet Singh
  • 681
  • 1
  • 7
  • 22
1

This occurs when one downloads using HTTPS rather than the SSH,easiet way which I implemented was I pushed everything as I made a few changes once wherein it asked for the username and password, then I removed the directory from my machine and git clone SSH address. It was solved.

Just clone it using SSH rather than HTTP and it won't ask for username or password.

Also having two-factor authentication creates the problem even when you download using SSH so disabling it solves the issue.

Riya_Dhar
  • 31
  • 1
  • 4
1
  1. Open the Windows credential manager and remove the git:https://dev.azure.com/orgname from generic credential. For steps look into Why TFS with GIT is not working from command line?
  2. Delete the .git-credentials files from the folder C:\Users\{username}.
  3. Make sure you update the git latest version from https://git-scm.com/download/win
Karunakaran
  • 385
  • 5
  • 16
0

I faced this issue today. If you are facing this issue in November 2020 then you need to update your git version. I received an email telling me about this. Here is what exactly was the email by github team.

We have detected that you recently attempted to authenticate to GitHub using an older version of Git for Windows. GitHub has changed how users authenticate when using Git for Windows, and now requires the use of a web browser to authenticate to GitHub. To be able to login via web browser, users need to update to the latest version of Git for Windows. You can download the latest version at:

If you cannot update Git for Windows to the latest version please see the following link for more information and suggested workarounds:

If you have any questions about these changes or require any assistance, please reach out to GitHub Support and we’ll be happy to assist further.

Thanks, The GitHub Team

Sanan Ali
  • 2,349
  • 1
  • 24
  • 34
0

I tried these steps and it worked :

  1. Create a personalized access token : https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

  2. Add the token to Android studio (File->Settings->Version Control->Github->Add - Login with token)

  3. Goto File->Settings->Version Control->Git and uncheck 'Use Credential Helper'

Reejesh
  • 1,745
  • 2
  • 6
  • 15