http://gitblit.com/federation.html

A Gitblit federation is a mechanism to clone repositories and keep them in sync from one Gitblit instance to another.

Federation can be used

to maintain a mirror of your Gitblit instance,

to aggregate使聚集 repositories from developer workstations,

or to initially clone groups of repositories to developer workstations.

If you are/were a Subversion user you might think of this as svn-sync, but better.

If your Gitblit instance allows federation and it is properly registered with another Gitblit instance, each of the non-excluded repositories of your Gitblit instance can be mirrored, in their entirety, to the pulling Gitblit instance.

You may optionally allow pulling of user accounts and backup of server settings.

The federation feature should be considered a security backdoor and enabled or disabled as appropriate for your installation.
Please review all the documentation to understand how it works and its limitations.

Important Changes to Note

The Gitblit 0.8.0 federation protocol adds retrieval of teams and referenced push scripts. Older clients will not know to request team or push script information.

The Gitblit 0.7.0 federation protocol is incompatible with the 0.6.0 federation protocol because of a change in the way timestamps are formatted.

Gitblit 0.6.0 uses the default google-gson timestamp serializer which generates locally formatted timestamps.

Unfortunately, this creates problems for distributed repositories and distributed developers.

Gitblit 0.7.0 corrects this error by serializing dates to the iso8601 standard.

As a result 0.7.0 is not compatible with 0.6.0.

A partial backwards-compatibility fallback was considered but it would only work one direction and since the federation mechanism is bidirectional it was not implemented.

Origin Gitblit Instance Requirements

  • git.enableGitServlet must be true, all Git clone and pull requests are handled through Gitblit's JGit servlet
  • federation.passphrase must be non-empty
  • The Gitblit origin instance must be http/https accessible by the pulling Gitblit instance.
    That may require configuring port-forwarding on your router and/or opening ports on your firewall.

federation.passphrase(用来生成共享的token,并非将它提供给其他人[区分大小写])

The passphrase is used to generate permission tokens that can be shared with other Gitblit instances.

The passphrase value never needs to be shared, although if you give another Gitblit instance the ALL federation token then your passphrase will be transferred/backed-up along with all other server settings.

This value can be anything you want: an integer, a sentence, an haiku俳句, etc.

You should probably keep the passphrase simple and use standard Latin characters to prevent Java properties file encoding errors.

The tokens generated from this value are affected by case, so consider this value CASE-SENSITIVE.

The federation feature is completely disabled if your passphrase value is empty.

NOTE:
Changing your federation.passphrase will break any registrations you have established with other Gitblit instances.

Pulling Gitblit Instance Requirements

  • consider setting federation.allowProposals=true to facilitate使容易 the registration process from origin Gitblit instances
  • properly registered Gitblit instance including, at a minimum, url, federation token, and update frequency

Controlling What Gets Pulled  [需要将源Gitblit的url和token提供给pulling的Gitblit,token可以在日志以及webui中找到]

If you want your repositories (and optionally users accounts and settings) to be pulled by another Gitblit instance,

you need to register your origin Gitblit instance with a pulling Gitblit instance by providing the url of your Gitblit instance and a federation token.

Gitblit generates the following standard federation tokens:

String allToken = SHA1(passphrase + "-ALL");
String usersAndRepositoriesToken = SHA1(passphrase + "-USERS_AND_REPOSITORIES");
String repositoriesToken = SHA1(passphrase + "-REPOSITORIES");

The ALL token allows another Gitblit instance to pull all your repositories, user accounts, server settings, and referenced push scripts.
The USERS_AND_REPOSITORIES token allows another Gitblit instance to pull all your repositories and user accounts.
The REPOSITORIES token only allows pulling of the repositories.

Individual Gitblit repository configurations such as description and accessRestriction are always mirrored.

If federation.passphrase has a non-empty value,

the federation tokens

are displayed in the log file

and are visible, to administrators, in the web ui.

在日志里可以找到

2017-05-20 16:21:09 [INFO ] Federation ALL token = 519c5f7dedfd8a5d52845e2e3ddfbbeab1343f03
2017-05-20 16:21:09 [INFO ] Federation USERS_AND_REPOSITORIES token = 30ff1e40ced5f48d33a9f4336f6d4b1d482b4420
2017-05-20 16:21:09 [INFO ] Federation REPOSITORIES token = 7ab4adcc149a3785d36cfaddafb6b24ae1956d61

The three standard tokens grant access to ALL your non-excluded repositories.

However, if you only want to specify different groups of repositories to be federated then you need to define federation sets.

Federation Sets

Federation Sets (*federation.sets*) are named groups of repositories.

The Federation Sets are defined in gitblit.properties and are available for selection in the repository settings page.

You can assign a repository to one or more sets and then distribute the federation token for the set.

This allows you to grant federation pull access to a subset of your available repositories.

Tokens for federation sets only grant pull access for the member repositories.

Gitblit的编辑界面,有一个是针对federation的

# Federation pull registrations
# Registrations are read once, at startup.
#
# RESTART REQUIRED
#
# frequency:
# The shortest frequency allowed is every 5 minutes
# Decimal frequency values are cast to integers
# Frequency values may be specified in mins, hours, or days
# Values that can not be parsed or are unspecified default to *federation.defaultFrequency*
#
# folder:
# if unspecified, the folder is *git.repositoriesFolder*
# if specified, the folder is relative to *git.repositoriesFolder*
#
# bare:
# if true, each repository will be created as a *bare* repository and will not
# have a working directory.
#
# if false, each repository will be created as a normal repository suitable
# for local work.
#
# mirror:
# if true, each repository HEAD is reset to *origin/master* after each pull.
# The repository will be flagged *isFrozen* after the initial clone.
#
# if false, each repository HEAD will point to the FETCH_HEAD of the initial
# clone from the origin until pushed to or otherwise manipulated.
#
# mergeAccounts:
# if true, remote accounts and their permissions are merged into your
# users.properties file
#
# notifyOnError:
# if true and the mail configuration is properly set, administrators will be
# notified by email of pull failures
#
# include and exclude:
# Space-delimited list of repositories to include or exclude from pull
# may be * wildcard to include or exclude all
# may use fuzzy match (e.g. org.eclipse.*)

#
# (Nearly) Perfect Mirror example
#

#federation.example1.url = https://go.gitblit.com
#federation.example1.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
#federation.example1.frequency = 120 mins
#federation.example1.folder =
#federation.example1.bare = true
#federation.example1.mirror = true
#federation.example1.mergeAccounts = true

Federation Proposals (Origin Gitblit Instance)

Once you have properly setup your passphrase and can see your federation tokens, you are ready to share them with a pulling Gitblit instance.

The registration process can be partially automated by sending a federation proposal to the pulling Gitblit instance.
To send a proposal:

  1. Login to your Gitblit instance as an administrator
  2. Select and click the propose link for the appropriate token on the federation page
  3. Confirm the publicly accessible url of your (origin) Gitblit instance
  4. Enter the url of the pulling Gitblit instance you want to federate with
  5. Optionally enter a message for the administrators
  6. Click propose

Not all Gitblit instances accept federation proposals, there is a setting which allows Gitblit to outright reject them. In this case an email or instant message to the administrator of the other Gitblit instance is required. :)

If your proposal is accepted, the proposal is cached to disk on the pulling Gitblit server and, if properly configured, the administrators of that Gitblit server will receive an email notification of your proposal.

Your proposal includes:

  1. the url of your Gitblit instance
  2. the federation token you selected and its type
  3. the list of your non-excluded repositories, and their configuration details, that you propose to share

Submitting a proposal does not automatically register your server with the pulling Gitblit instance.
Registration is a manual process for an administrator.

总结:

第一步:在origin的Gitblit中设置git.enableGitServlet=true;【默认为true】

并且federation.passphrase设置为非空的值;【默认是空】

同时确保打开了http/https

第二步:federation.allowProposals=true

Gitblit从一个服务器,迁移到另外一个服务器的更多相关文章

  1. ORACLE 从一个实例迁移到另外一个实例实战记录

    .schema1到schema2的迁移 Oracle 从一个用户expdp导出再impdp导入到还有一个用户,能够使用REMAP_SCHEMA=user1:user2来实现: 假设想导入的用户已经存在 ...

  2. 如何将App从一个账号迁移到另一个账号?

    App迁移(App transfer):将App从一个开发者账号迁移至另一个开发者账号.此文演示了整个迁移过程,为了方便解释,在此过程中,将App转出的开发者账号我们下文将会称之为A账号,接收杭州Ap ...

  3. github仓库迁移到gitlab以及gitlab仓库迁移到另一个gitlab服务器

    一. github仓库迁移到gitlab 先进入 new project: 选择 Import project, 选择下面的github: 进入后,这里需要github的 personal acces ...

  4. 在linux上使用"scp"命令拷贝一个目录到另一台服务器的时候报"not a regular file"错误的解决办法

    今天在linux命令行使用scp命令拷贝一个目录到另一台服务器的时候,报如下错误: [root@hadoop01 ~]# scp flume -r hadoop02:/root/apps flume: ...

  5. NodeJS服务器:一行代码 = 一个的HTTP服务器

    从这一篇开始,我们进入技术讲解的话题,逐步实现用NodeJS实现文件的传送共享服务. 前文我们讲过,NodeJS是最擅长做网络服务器的,今天我们就来用NodeJS做一个最简单的服务器. 先看一幅图: ...

  6. Xshell利用登录脚本从服务器登录到另外一个服务器

    欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...

  7. 搭建CAS服务器,并实现一个简单的单点登录的demo

    官网:http://jasig.github.io/cas/Cas Server下载:http://developer.jasig.org/cas/Cas Client下载:http://develo ...

  8. Nginx系列2:用Nginx搭建一个可用的静态资源Web服务器

    上一节中编译好自己的nginx服务器后, 现在要对nginx.conf文件进行配置,搭建一个可用的静态资源Web服务器 1.放入可访问的html文件到nginx文件夹下,如图1所示: 这里我放入的是一 ...

  9. [傻瓜式一步到位] 阿里云服务器Centos上部署一个Flask项目

    网络上关于flask部署Centos的教程有挺多,不过也很杂乱. 在我第一次将flask上传到centos服务器中遇到了不少问题,也费了挺大的劲. 在参考了一些教程,并综合了几个教程之后才将flask ...

  10. django搭建一个小型的服务器运维网站-查看服务器中的日志与前端的datatable的利用

    目录 项目介绍和源码: 拿来即用的bootstrap模板: 服务器SSH服务配置与python中paramiko的使用: 用户登陆与session; 最简单的实践之修改服务器时间: 查看和修改服务器配 ...

随机推荐

  1. NOIp2018模拟赛四十四

    加量不加价?! 昨晚看时间变成了3.5h以为终于变成了正常难度,结果还是国家集训队作业... A题看起来很神仙,B题看上去很神仙,C题一看就知道很神仙: 结果发现B是假题,放榜后发现A也是假题,C是Y ...

  2. GDOI2018爆炸记

    Day0 12:45p.m. 从初中部出发前回班探望了一下同学,受到热烈欢迎(?) 13:15p.m. 出发去中山,路上本来想用mac看fz的,结果ass字幕导入失败,心态爆炸*1:后来成功获取xfz ...

  3. BZOJ 3790 神奇项链(回文自动机+线段树优化DP)

    我们预处理出来以i为结尾的最长回文后缀(回文自动机的构建过程中就可以求出)然后就是一个区间覆盖,因为我懒得写贪心,就写了线段树优化的DP. #include<iostream> #incl ...

  4. Bedrock Linux 0.7.3 发布

    Bedrock Linux是一种元分发,允许用户利用其他通常互斥的Linux发行版的功能,并让它们无缝地一起工作.该项目发布了其0.7.x系列,Bedrock Linux 0.7.3的更新. 新的更新 ...

  5. centeros 7开机自动挂载磁盘

    场景: 使用mount命令将新发现的磁盘/dev/sdb挂载给/liu后,但是重启后又看不到磁盘? 问题导致原因: 虽然我们可以使用mount命令去挂载磁盘,但是此操作只对服务器运行期间有效,也就是临 ...

  6. 关于vue事件监听的一个问题

    由于新工作需要用vue,所以最近接触最多的也是vue,因为之前一直在用react,所以对于vue上手还是很快的.我也尽量找一些他们两个的异同点,除了多了一些辅助用的方法以外,最大的不同应该是对于组件间 ...

  7. UVALive 3989 Ladies' Choice

    Ladies' Choice Time Limit: 6000ms Memory Limit: 131072KB This problem will be judged on UVALive. Ori ...

  8. js时间格式化函数,支持Unix时间戳

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  9. Gradle学习之自己定义属性

    请通过下面方式下载本系列文章的Github演示样例代码: git clone https://github.com/davenkin/gradle-learning.git     在前面的文章中我们 ...

  10. 反弹木马——本质上就是一个开80端口的CS程序,伪造自己在浏览网页

    反弹端口型木马分析了防火墙的特性后发现:防火墙对于连入的链接往往会进行非常严格的过滤,但是对于连出的链接却疏于防范.于是,与一般的木马相反,反弹端口型木马的服务端(被控制端)使用主动端口,客户端(控制 ...