基本使用

git是一个分布式代码管理工具,所以可以支持多个仓库,在git里,服务器上的仓库在本地称之为remote

直接clone一个仓库:

$: git clone git@search.ued.taobao.net:projects/search.git

另外一种clone方式:

# 创建目录初始化本地仓库
$: mkdir search && cd search
$: git init
# 添加远程仓库路径
$: git remote add github git@github.com:yyfrankyy/search.git
# 实际上,pull 就是 fetch + merge
$: git pull github --all --tags

把工作目录迁移到github上面:

$: git remote add github git@github.com:yyfrankyy/search.git
$: git push github --all --tags

显示所有的远程仓库

$: git remote -v
origin git@search.ued.taobao.net:projects/search.git (fetch)
origin git@search.ued.taobao.net:projects/search.git (push)
github git@github.com:yyfrankyy/search.git (fetch)
github git@github.com:yyfrankyy/search.git (push)

重命名远程仓库

$: git remote rename github gh
$: git remote
origin
gh

删除远程仓库

$: git remote rm github
$: git remote
origin

从远程仓库抓取数据,更新本地仓库:

$: git fetch origin
remote: Counting objects: 58, done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 44 (delta 24), reused 1 (delta 0)
Unpacking objects: 100% (44/44), done.
From git://search.ued.taobao.net:projects/search.git
* [new branch] product -> origin/product

查看远程仓库信息,可用于跟踪别人的push

$: git remote show origin
* remote origin
Fetch URL: git@search.ued.taobao.net:projects/search.git
Push URL: git@search.ued.taobao.net:projects/search.git
HEAD branch: master
Remote branches:
master tracked
p4popt tracked
prepub tracked
product tracked
Local branches configured for 'git pull':
master merges with remote master
p4popt merges with remote p4popt
prepub merges with remote prepub
product merges with remote product
Local refs configured for 'git push':
master pushes to master (up to date)
p4popt pushes to p4popt (up to date)
prepub pushes to prepub (up to date)
product pushes to product (up to date)
 
 
转自 http://blog.csdn.net/pgmsoul/article/details/7883706

Git Remote (转)的更多相关文章

  1. 修改git remote url

    $ ssh -v wangz@gitlab.alibaxx-inc.com $ git remote ali set-url git@gitlab.alibaxx-inc.com:youk-aaa/x ...

  2. Git remote 修改源

    Git remote 修改源 git commit -m "Change repo." # 先把所有为保存的修改打包为一个commit git remote remove orig ...

  3. 聊下 git remote prune origin

    在你经常使用的命令当中有一个git branch –a 用来查看所有的分支,包括本地和远程的.但是时间长了你会发现有些分支在远程其实早就被删除了,但是在你本地依然可以看见这些被删除的分支. 你可以通过 ...

  4. [译]git remote

    git remote命令让我们可以创建, 查看, 删除一个到其他仓储的连结. 下图展示了我们的本地仓储有两个remote连接, 一个是中央仓储, 一个是其他开发者的仓储. 除了使用完整的url指向他们 ...

  5. git remote 相关用法

    为了便于管理,Git要求每个远程主机都必须指定一个主机名.git remote  命令就用于管理主机名. 不带选项的时候,git remote命令列出所有远程主机. $ git remote orig ...

  6. git remote log error

    使用git pull的时候收到以下信息: error: there are still refs under 'refs/remotes/origin/xxxx'From 10.1.25.57:yyy ...

  7. How to get started with GIT and work with GIT Remote Repo

    https://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html#zz-7. 1.  Introduction GIT is a ...

  8. git remote

    在git里,服务器上的仓库在本地称之为remote. 直接clone一个仓库: $: git clone git@search.ued.taobao.net:projects/search.git 另 ...

  9. git命令之git remote的用法

    git remote git  remote -v git init git add xxx git commit -m 'xxx' git remote add origin ssh://softw ...

  10. 使用tortoisegit工具git地址中带号码密码的拉取,以及使用这种方式后中途重置密码报git remote: HTTP Basic: Access denied 错误解决办法

    1. 在拉取git项目时可以在地址中直接指定号码密码如下就可以直接拉取下来 https://username:password@github.com   需要注意,因为在解析地址时是以@符号作为地址信 ...

随机推荐

  1. conda 里的 jupyter

    1. 安装conda https://mirrors.tuna.tsinghua.edu.cn/anaconda/ 下载并安装. 2. 安装jupyter (1)在ananconda主环境安装:pip ...

  2. ffmpeg 纯静态编译,以及添加自定义库流程摘要

    需求:    1. 纯静态编译ffmpeg ,即ldd ./ffmpeg 的结果是:not a dynamic executable    2.  修改ffmpeg 项目,添加自定义功能库    3. ...

  3. 音频压缩(Speex使用&Opus简介)--转

    博客地址:http://blog.csdn.net/kevindgk GitHub地址:https://github.com/KevinDGK/MyAudioDemo 一简介 二局域网语音配置 三Sp ...

  4. Web实现音频、视频通信

    Google开源实时通信项目WebRTC Google正式开源了WebRTC实时通信项目,希望浏览器厂商能够将该技术内建在浏览器中,从而使Web应用开发人员能够通过HTML标签和JavaScript ...

  5. Poj 2017 Speed Limit(水题)

    一.Description Bill and Ted are taking a road trip. But the odometer in their car is broken, so they ...

  6. 数组排序----Demo

    //选择排序,分为简单选择排序.树形选择排序(锦标赛排序).堆排序 此算法为简单选择排序 public static void selectSort(int[] a){ for(int i=0;i&l ...

  7. Jenkins配置邮件SMTP(使用QQ邮箱)

    一.QQ邮箱中开启SMTP服务 进入QQ邮箱的设置页面,选择开启POP3/SMTP服务 需要发送一条短信开启服务,成功后,会收到一个密码,一定要截图.复制密码保存好 二.Jenkins中配置SMTP ...

  8. maven可用镜像

    <mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> & ...

  9. Bluetooth Functions

    The functions in this section are used for managing Bluetooth devices and services. Bluetooth is als ...

  10. CentOS 7 搭建 LAMP

    一.安装httpd 1.yum install httpd -y 2.启动服务:systemctl start httpd 3.设置开机启动:systemctl enable 二.安装mariadb ...