Git push requires username and password

前端 未结 24 2049
灰色年华
灰色年华 2020-11-22 04:14

I cloned a Git repository from my GitHub account to my PC.

I want to work with both my PC and laptop, but with one GitHub account.

When I try to push to or p

24条回答
  •  情深已故
    2020-11-22 04:44

    A common cause is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking "Clone or download", then clicking the "Use SSH" button above the URL field and updating the URL of your origin remote like this:

    git remote set-url origin git@github.com:username/repo.git
    

    This is documented at GitHub: Switching remote URLs from HTTPS to SSH.

提交回复
热议问题