SourceTree keeps asking for Github password

My organization is switching from Bitbucket to Github for project management. Today, I was trying to transfer our most recent project from Bitbucket to Github, by using SourceTree. I added a second remote repository to the project (using the URL of the destination repository on Github), brought everything up to date, and then attempted to push the code to the repository. A box popped up, asking for the password to my Github account. I entered in my (correct) password, and clicked 'OK', and the dialog box popped up again. I entered in my password (correctly) again, and it did the same thing.

My username is correctly identified, my password is correct, and I tried updating SourceTree because I had heard that it was an issue with a previous version. The problem persists.

I am using SourceTree 2.3.1


If you are using two-factor authentication with GitHub you will need to create a personal access token and use it with SourceTree:

To work with GitHub's two-factor authentication in SourceTree you can simply use your access token instead of your password. The steps to do this are as follows:

  • Go to your Personal Access Tokens settings in GitHub.
  • Click on the Generate new token button.
  • Name the token something descriptive.
  • Select which scopes you wish to grant this token.
  • Click the Generate token button.
  • Copy the token and use it as a password in your hosted repositories.
  • You can find more information about this on GitHub's help here.

    Mac Users: If your SourceTree keeps on asking for the password, go to the Terminal and type this:

    git config --global credential.helper osxkeychain
    

    open terminal and clone your repo. repository url must have your usedid, For ex:

    $ git clone https://<username>@github.com/<userId>/<reponame>.git
    $ git clone https://mark@github.com/mak123/<reponame>.git
    

    Then drag and drop the cloned folder into the sourceTree window.You can also do by clicking "+New Repository" button and from the menu by selecting "Add Existing Local Repository". It may ask for password again but this time it will get added to your keychain.


    If you are not using GitHub 2FA, another reason for asking you your password is:

    Your GitHub repo url is an ssh one, not an https one.
    Since git does not find your ssh keys (or your ssh key is not registered to your GitHub account), it fails back to account/password mechanism.

    If you are using 2FA (and an https url), then you need a personal token as a password.

    链接地址: http://www.djcxy.com/p/22072.html

    上一篇: 有没有像临时存储git登录但不是密码的方法?

    下一篇: SourceTree不断要求Github密码