git杂记-远程仓库的使用

  1. 查看远程仓库;克隆自己的仓库,如不命名则默认远程仓库名字为origin;
    $ git clone https://github.com/OuFeng/JF_WEB.git
    Cloning into 'ticgit'...
    remote: Reusing existing pack: 1857, done.
    remote: Total 1857 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (1857/1857), 374.35 KiB | 268.00 KiB/s, done.
    Resolving deltas: 100% (772/772), done.
    Checking connectivity... done.
    $ cd ticgit
    $ git remote -v         --查看本地仓库中对应有哪些远程仓库;如果远程仓库不止有一个的话,则会列出多个仓库。

      origin https://github.com/OuFeng/JF_WEB.git (fetch)
      origin https://github.com/OuFeng/JF_WEB.git (push)

     

  2. 添加远程仓库;名称为pb。
    $ git remote
    origin
    $ git remote add pb https://github.com/paulboone/ticgit
    $ git remote -v
    origin    https://github.com/schacon/ticgit (fetch)
    origin    https://github.com/schacon/ticgit (push)
    pb    https://github.com/paulboone/ticgit (fetch)
    pb    https://github.com/paulboone/ticgit (push)

     

  3. 从远程仓库抓取与拉取。
    --抓取origin远程库的所有分支;只抓取数据,并不自动合并;
    $ git fetch origin
    --拉取origin远程库的所有分支;只抓取数据,自动合并;
    $ git pull origin

     

  4. 推送到远程仓库;推送到origin仓库的master分支;
    $ git push origin master

     

  5. 查看远程仓库,查看origin仓库的更多信息
    $ git remote show origin

     

  6. 远程仓库的重命名和删除
    --把远程仓库pb重命名为paul
    $ git remote rename pb paul
    
    
    --删除paul远程分支的引用
    $ git remote rm paul

     

posted @ 2017-04-03 18:40  欧欧欧锋_  阅读(182)  评论(0编辑  收藏  举报