美文网首页
MAC 解决git push上传提示输入用户名密码问题

MAC 解决git push上传提示输入用户名密码问题

作者: 囧囧的猪 | 来源:发表于2020-05-08 19:05 被阅读0次

    今天系统重做了,上传代码时发现总是提示输入用户名和密码。

    图1

    问题原因

    因为我用http方式clone到本地的,也是用http方式push的

    图2

    当时clone用的是默认的http方式:

       git clone https://github.com/xxxx/your_program.git
    

    问题解决

    更换使用ssh方式clone

    // 先移除旧的http的origin
    git remote rm origin
    
    // 再用ssh的方式clone项目
    git remote add origin git@github.com:xxxx/your_program.git
    
    图3

    查看clone方式是否变更成功

    git remote -v
    
    图4

    已经变更成功,最后我们再更新一下,追踪上下游分支

     git push --set-upstream origin master
    

    完成!

    相关文章

      网友评论

          本文标题:MAC 解决git push上传提示输入用户名密码问题

          本文链接:https://www.haomeiwen.com/subject/gndqnhtx.html