git remote命令让我们可以创建, 查看, 删除一个到其他仓储的连结.

下图展示了我们的本地仓储有两个remote连接, 一个是中央仓储, 一个是其他开发者的仓储. 除了使用完整的url指向他们, 还可以通过别名来执行他们. 一般情况下origin就是我们的中心仓储的别名.

用法

git remote

列出来你的仓储有哪些远程连接.

git remote -v

和上面的命令类似, 但是他列出了每个连接的url地址.

git remote add <name> <url>

创建一个连接到远程仓储的连接. 添加后你可以使用<name>做为<url>的一个别名.

git remote rm <name>

删除一个远程连接

git remote rename <old-name> <new-name>

修改远程连接的别名.

讨论

当你使用git clone一个仓储的时候, 会自动创建一个别名为origin的远程连接到你clone的仓储.

例子

如果你的同事John有一个公共的仓储dev.example.com/john.git, 你可以用如下的方法添加一个连接到John:

git remote add john http://dev.example.com/john.git

  

[译]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要求每个远程主机都必须指定一个主机名.git remote  命令就用于管理主机名. 不带选项的时候,git remote命令列出所有远程主机. $ git remote orig ...

  5. git remote log error

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

  6. 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 ...

  7. git remote

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

  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. 轻量级Web API实现,带接口界面的Jayrock JsonRPC接口组件升级版

    升级功能如下: 1.增加模块名称.输入参数.输出参数注释 2.增加Sign验证.输入数据解密.输出数据解密重写方法 3.增加集成Demo规范 4.增加模块分类.接口快速定位.接口调用说明.接口输入输出 ...

  2. HDU 1710 Binary Tree Traversals(二叉树遍历)

    传送门 Description A binary tree is a finite set of vertices that is either empty or consists of a root ...

  3. href和src的使用场景

    href和src的使用场景 href和src的用法虽然简单,但是有时候会突然记不起来该怎么用,且两者不可相互替换,下面列出来方便记忆,并给出具体区别. href的使用: 1.外部css引用:<l ...

  4. winndows7、office2013 激活信息还原

    windows7激活信息还原 1.现在“计算机”,右键中的“管理”中的“服务”中禁止Software Protection 2.还原路径C:\Windows\ServiceProfiles\Netwo ...

  5. 如果将CTE 用在属于批处理的一部分的语句中

    declare @s nvarchar(3) set @s = 'C%' ; -- 必须加分号with t_tree as ( select CountryRegionCode from person ...

  6. matlab解三元二次方程组

    C1=7.0863; C2=6.8971; C3=0.4929; C4=0.8131; C5=1.8240; C6=3.8108; C7=3.7318; C8=-2.2238; C9=1.9905; ...

  7. Ankh不起作用的解决方法

    请检查Visual Studio 2008的Tool > Options... > Source Control,在下拉菜单中选择插件.

  8. UITextField限制输入文字

    一.viewDidLoad时监听通知 NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addO ...

  9. UITableViewCell的separator分隔线设置失效

    // 处理separator -(void)viewDidLayoutSubviews { if ([self.tableView respondsToSelector:@selector(setSe ...

  10. Spring系列之beanFactory与ApplicationContext

    一.BeanFactoryBeanFactory 是 Spring 的“心脏”.它就是 Spring IoC 容器的真面目.Spring 使用 BeanFactory 来实例化.配置和管理 Bean. ...