基本使用

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. Gym - 100513B:Colored Blankets (构造)(存疑)

    题意:给定N的棒棒,K种颜色,每个棒棒的两端可以涂色.现在已知所有的线段要么有一端涂色,要么两端都没有涂色,现在要求把所有的没涂色的部分涂色,使得我们可以把涂色后的棒棒分为N/K组,每组的涂色情况相同 ...

  2. 理解Promise

    一.Propmise基本用法 Promise用于发送一个异步完成的结果,是替代回调函数的另一种选择.可以把Promise理解为一种异步函数. 以下函数通过一个Promise来异步地返回一个结果 fun ...

  3. for循环中的条件执行循序

    问题: public class Main { public static void main(String[] args) { int i,n,length = 0; for(i=1;length& ...

  4. Poj 2017 Speed Limit(水题)

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

  5. keil5编译时出现 MDK-Pro middleware is not allowed with this license

    转载请注明出处:http://blog.csdn.net/qq_26093511/article/details/51700961 最近在用MDK编译一个别人的工程时,有如上提示: 1.原因是没有注册 ...

  6. DevExpress 柱状图

    通过构造函数,把值传递过来 public XtraInterpreterChartForm(object ds) { InitializeComponent(); datasource = ds; } ...

  7. BluetoothSetServiceState 函数

    DWORD BluetoothSetServiceState( HANDLE hRadio, BLUETOOTH_DEVICE_INFO* pbtdi, GUID* pGuidService, DWO ...

  8. 浏览器重绘(repaint)和回流(reflow)的那点事

    第一次听到重绘和回流是在鹅厂实习面试,那个时候对浏览器没有任何的概念,所以面试官说到这个问题的时候整个人都蒙圈了.下面是近期学习总结: 重绘(repaint)和回流(reflow) 文档初次加载时,H ...

  9. OpenCV创建轨迹条,图片像素的访问

    .OpenCV创建进度条以及图像对比度,亮度调整 1.创建轨迹条createTrackbar() 函数原型C++: intcreateTrackbar(conststring& trackba ...

  10. Java探索之旅(4)——方法和Random&Math类

    1.基本知识点    ❶方法在C++里面称为函数.调用方法时,应该类型兼容--即不需显式类型转换即可将形参传递给实参.    ❷形参的改变不影响实参的值.    ❸Java注重模块化设计和自顶向下的设 ...