zoukankan      html  css  js  c++  java
  • 【经验】github

    1.pull免密码
    git config --global credential.helper store

    2.git多账号并存
    先参考http://www.cnblogs.com/BeginMan/p/3548139.html

    创建私钥
    $ cd ~/.ssh
    $ ssh-keygen -t rsa -C 'xx@qq.com'

    设置名称,默认为id_rsa。注意不能与已有的文件重复
    Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): id_rsa_personal

    接下来的流程参考
    将新密钥添加到SSH agent中:
    ssh-add ~/.ssh/id_rsa_personal

    假如提示Could not open a connection to your authentication agent,则根据http://unix.stackexchange.com/questions/48863/ssh-add-complains-could-not-open-a-connection-to-your-authentication-agent/48868#48868 中所说,执行:
    eval "$(ssh-agent)"
    再执行ssh-add ~/.ssh/id_rsa_personal即可。

    接下来进入~/.ssh目录,打开config文件,如果没有就如下创建:
    touch config

    然后是config的设置。这里不要看上面的网站,可以参考先参考http://www.tuicool.com/articles/7z67ny2

    而我的写法是:
    #这里教程里写成git.oschina.net,我在前面加了个"work."
    #因为有时候就是不行,提示Access denied。
    Host work.git.oschina.net
    HostName git.oschina.net
    User git
    IdentityFile C:/Users/admin/.ssh/id_rsa
    #IdentitiesOnly yes

    #注意两个Host不能一样
    Host personal.git.oschina.net
    #这里的意思大概是如果使用了一个地址,
    #而地址匹配了Host中设的"personal.git.oschina.net",
    #则这一段将被替换为HostName所设的"git.oschina.net"
    HostName git.oschina.net
    User git
    IdentityFile C:/Users/admin/.ssh/id_rsa_personal
    #IdentitiesOnly yes

    这样设置之后,如果是直接使用git.oschina.net,可能会以默认的id_rsa(即上述的第一段)去处理。

    设置了host后,已经存在的项目可能需要设置一下。
    #删除掉值为git@work.git.oschina.net....的origin仓库地址
    git remote remove origin
    #增加有前缀的仓库地址
    git remote add origin git@work.git.oschina.net....

  • 相关阅读:
    app测试的一些较为重要的测试点
    adb工作常用命令
    vue中$attrs $listeners你会用吗?
    Vue中组件通信的常用方式
    Vue中watch 的用法
    VUE中使用 async await 将 axios 异步请求同步化处理
    安装spyder记录
    树莓CM3开机连接WIFI
    树莓派搭建seafile服务器备忘
    关于JAVA数据结构_线性表(通过单向链表实现)的学习
  • 原文地址:https://www.cnblogs.com/followBlade/p/6511451.html
Copyright © 2011-2022 走看看