美文网首页
git 上传命令

git 上传命令

作者: PengPengPro | 来源:发表于2018-07-07 17:10 被阅读7次

    第一步:

    git remote add origin url  //[https://github.com/nodejs-team/evtGulp.git](https://github.com/nodejs-team/evtGulp.git)
    

    第二步:

    git add .  //"." 表示所有目录,也可跟目录名或文件名
    

    第三步:

     git commit -m "add src"  // 将目录提交到本地并加版本说明
    

    第四步:

    git push origin master   // 将目录提交到远程仓库
    

    其它命令:

    git pull origin master  // 将远程仓库拉取到本地
    
    git remote set-url origin git@github.com:nodejs-team/evtGulp.git
    
       git config --global user.name "Your Name"
    
       git config --global user.email "email@example.com"
    
    git rm fileName  // 移除文件
    
    git rm -r folderName  // 移除文件夹
    
    git 修改远程仓库地址 
    

    方法有三种:

    1. 修改命令

    git remote origin set-url [url]

    2. 先删后加

    git remote rm origin

    git remote add origin [url]

    3. 直接修改 config 文件

    git pull origin master //pull 会自动合并更新

    git fetch origin master //fetch 不会自动合并更新

    分支管理

    [http://blog.csdn.net/arkblue/article/details/9568249/](http://blog.csdn.net/arkblue/article/details/9568249/)
    
    [http://blog.csdn.net/xiahouzuoxin/article/details/23140727](http://blog.csdn.net/xiahouzuoxin/article/details/23140727)
    

    配置 ssh key

    $ git config --global user.name "semdy"
    
    $ git config --global user.email "501859275@qq.com"
    

    检测是否生成过 key

    $ cd ~/.ssh
    

    找到. ssh 目录下的两个文件

    $ ssh-keygen -t rsa -C "501859275@qq.com"
    

    在 github 上添加 SSH key

      在 github 上点击 “setting”,找到添加 SSH key 的菜单,然后新增 SSH key;把文件 id_rsa.pub 里面的内容全部复制到 key 编辑框中,保存完毕;
    

    检查 SSH key 是否有效

    $ ssh -T git@github.com
    

    参考地址:

    http://jingyan.baidu.com/article/dca1fa6f756777f1a44052e3.html

    相关文章

      网友评论

          本文标题:git 上传命令

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