Git push requires username and password

前端 未结 24 2497
灰色年华
灰色年华 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条回答
  •  萌比男神i
    2020-11-22 04:34

    For the uninitiated who are confused by the previous answers, you can do:

    git remote -v
    

    Which will respond with something like

    origin    https://yourname@github.com/yourname/yourrepo.git (fetch)
    origin    https://yourname@github.com/yourname/yourrepo.git (push)
    

    Then you can run the command many other have suggested, but now you know yourname and yourrepo from above, so you can just cut and paste yourname/yourrepo.git from the above into:

    git remote set-url origin git@github.com:yourname/yourrepo.git
    

提交回复
热议问题