美文网首页
git基本使用

git基本使用

作者: purewater2014 | 来源:发表于2019-04-02 18:23 被阅读0次

    1.账号配置

    设置账号
    git config --global user.name "xxx" // 配置全局用户名,如Github上注册的用户名
    git config --global user.email "yyy@mail.com" // 配置全局邮箱,如Github上配置的邮箱
    删除账号
    git config --global --unset user.name
    git config --global --unset user.email
    

    2.ssh配置

    1.生成秘钥
    ssh-keygen -t rsa -C "liugui@hust.edu.cn"
    2.进入系统.ssh文件夹,在.ssh目录下新建一个config文件
    内容设置:
    Host github // 网站的别名,随意取
    HostName github.com // 托管网站的域名
    User liugui // 托管网站上的用户名
    IdentityFile ~/.ssh/id_rsa_github // 使用的密钥文件
    多个账户
    // GitLab的配置相同
    Host gitlab
    HostName gitlab.com
    User liugui
    IdentityFile ~/.ssh/id_rsa_gitlab
    3.公钥添加到托管网站
    4.测试
    ssh -T git@github.com
    
    

    相关文章

      网友评论

          本文标题:git基本使用

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