在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)

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命令之git remote的用法

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

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

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

随机推荐

  1. python用openpyxl操作excel

    python操作excel方法 1)自身有Win32 COM操作office但讲不清楚,可能不支持夸平台,linux是否能用不清楚,其他有专业处理模块,如下 2)xlrd:(读excel)表,xlrd ...

  2. Android简易实战教程--第四十三话《上拉加载与下拉刷新》

    ListView的下拉刷新很常见,很多开源的框架都能做到这个效果,当然也可以自己去实现.本篇案例是基于xlistview的. 布局: <RelativeLayout xmlns:android= ...

  3. 【Android】给Android Studio设置代理

    先打开我们的Android Studio,点击工具栏的file下的settings,如下图 之后再搜索框上面输入Proxy,然后按第四步提示点击,如下图 之后就进入了设置代理的界面了,如下图 默认情况 ...

  4. Swift3中dispatch_once废弃的解决办法

    在Swift中如果想搞类的单例模式,那么在初始化的时候一般会使用just one time执行的方式,我们使用dispatch_once_t配合调用dispatch_once方法,一般的代码如下: s ...

  5. 剑指Offer——知识点储备-操作系统基础

    剑指Offer--知识点储备-操作系统基础 操作系统 操作系统什么情况下会出现死锁? 产生死锁的必要条件 (1)互斥条件:即某个资源在一段时间内只能由一个进程占有,不能同时被两个或两个以上的进程占有, ...

  6. Web自动化框架LazyUI使用手册(5)--模板工程:LazyUI-template详解

    概述: LazyUI-template: 提供Maven管理的,基于Spring+Testng的,包含常用浏览器driver的,方便连接各种数据库的java模板工程,并提供以百度搜索为例的第一个测试用 ...

  7. Apache shiro集群实现 (三)shiro身份认证(Shiro Authentication)

    Apache shiro集群实现 (一) shiro入门介绍 Apache shiro集群实现 (二) shiro 的INI配置 Apache shiro集群实现 (三)shiro身份认证(Shiro ...

  8. main函数之后的调用

    main函数代表进程的主线程.程序开始执行时,系统为程序创建一个进程,main函数其实并不是首先被调用的函数,而是操作系统调用了C/C++运行期启动函数,该函数负责对C/C++ 运行期库进行初始化.它 ...

  9. Dynamics CRM 插件注册时报Assembly must be registered in isolation的解决方法

    在插件注册的时候经常会遇到"Assembly must be registered in isolation"的问题导致无法注册,之前经常会被同事或者朋友问到这个问题,遇到这个问题 ...

  10. android view事件分发机制

    首先我们先写个简单的例子来测试View的事件转发的流程~ 1.案例 为了更好的研究View的事件转发,我们自定以一个MyButton继承Button,然后把跟事件传播有关的方法进行复写,然后添加上日志 ...