美文网首页程序猿的笔记本
Git日常常用命令汇总

Git日常常用命令汇总

作者: 88ea6130522d | 来源:发表于2017-10-13 09:45 被阅读3次

    本篇博文作为git日常常用命令总结,不定时更新

    拉取自己的代码库,可push

    $ git clone git@github.com:myname/myrepository.git
    

    拉取代码库,不可直接push

    $ git clone git://github.com/myname/myrepository.git
    

    常用三剑客命令,add commit push

    $ git add .
    $ git commit -m "add files" .
    $ git push origin master
    

    查看本机github配置

    $ git config --list
    

    设置本机github用户名与邮箱

    $ git config --global user.name "Your Name"
    $ git config --global user.email yourmail@example.com
    

    测试git连接是否正常

    $ ssh -T git@github.com
    

    生成公钥和密钥

    $ ssh-keygen -t rsa -C "yourmail@example.com"
    

    冲突后强制覆盖掉本地

    $ git reset --hard
    $ git pull
    

    本文最先发布于molock.cn帆的博客

    相关文章

      网友评论

        本文标题:Git日常常用命令汇总

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