Download from Git/zh


 * 从 MediaWiki 1.19beta2, 1.18.2, 1.17.3起, MediaWiki核心部分与扩展开始使用版本管理软件. 对于较旧的版本，请使用

Git是一个分布式版本控制软件，它允许用户获得最新的软件分支而不必等待应用开发者封包. MediaWiki可以更快的发行，同时让安装版本升级、回滚升级和提交Bug更方便. （当然官方发布版更稳定. ）

查看Git了解更多，特别是如何提交你对MediaWiki的更改，下面是一些常见任务的指南.

开始之前
使用前你要先安装Git. 有多种方式可以得到Git，取决于你的操作系统. 要获得源代码和官方二进制包，签出(check out)git-scm.com. 对于安装Git的其它方式，使用你最喜爱的搜索引擎来找到适合你的操作系统的安装指南.

It is recommended that you have composer installed to download and install third party libraries, but not required.

下载
You can download MediaWiki core using Git, as well as all extensions currently installed on the Wikimedia Foundation server cluster and many other extensions hosted on gerrit.

首先，克隆MediaWiki版本库，这需要一些时间.

In a terminal window, enter the following command: git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git

This clones the entire MediaWiki core repository into a subdirectory named core. To install into a specific directory, add that to the command line (for more info refer to these docs). The default "branch" will be, the cutting-edge, developer version of MediaWiki. Once the repository is cloned, you can easily switch to different branches or tags (see below), including those tracking stable versions of MediaWiki.

下载以进行开发
If you have Developer access (which is easy to request), then instead of cloning anonymously with https you should clone with your ssh  so that you can submit changes for review: git clone ssh:// @gerrit.wikimedia.org:29418/mediawiki/core.git



获取外部库
Starting with MediaWiki 1.25, some external libraries that MediaWiki requires are no longer in this "core" git repository. We use composer to manage them. To install these needed libraries, you have a choice:


 * Download and install composer, switch to your core directory and then run composer install --no-dev . 请注意如果现在已存在 composer.lock 文件，您需要运行 composer update --no-dev.


 * If you don't want to use composer, or if you want to use the same set of vendor libraries as used on the WMF production cluster, you can instead git clone https://gerrit.wikimedia.org/r/p/mediawiki/vendor.git to create a vendor/ directory inside the core folder of your MediaWiki installation.

WMF 分支
Remote branches track the MediaWiki versions used on the Wikimedia Foundation server cluster. These may not be entirely stable, but they receive very quick bug fixes and are generally stable enough – after all, these are what major projects such as Wikipedia are using. Once a REL* branch is considered 'stable', we 'tag' it and turn it into a tarball release.

To see what branches are available, switch to your MediaWiki core directory and enter the following command: git branch -r | sort -V 主要分支表示成origin/REL ，例如origin/. 要切换到特定的分支. git checkout -b REL origin/REL 例如要切换到稳定版本, ,键入: git checkout -b origin/

MediaWiki标签（稳定版本）
另外,特定的MediaWiki稳定版本使用'标签'进行跟踪. 这和web下载版本. 使用以下的命令查看可用的版本: git tag -l | sort -V 如果你使用非GNU的sort命令（例如在Mac OS X上使用），那么你必须依靠良好的旧式分隔符： git tag -l | sort -n -t. -k1 -k2 -k3

使用特定标签： git checkout

MediaWiki最新开发版
MediaWiki最新开发版使用'master'分支. 这是你首次克隆MediaWiki版本库时的默认的本地签出操作. 如果你曾切换到另一个分支，但是想切回MediaWiki的最前沿版本，那么请做如下操作： git checkout master

保持最新
If you're using a particular branch or the development version ("master" branch) of MediaWiki, picking up the latest changes is relatively easy. Change into your MediaWiki clone directory and issue the git pull command: git pull 这个分支的最新更改会合并到你的版本库上.

The new version of core may require newer versions of extensions and skins, so you must go into each extension and skin directory and update it with a command like git pull --recurse-submodules.

After updating/upgrading you should run the MediaWiki update.php command-line script to update database tables as needed: php maintenance/update.php

You also need to update mediawiki/vendor to any newer versions of required libraries, see.

If you use MediaWiki-Vagrant, it offers a single command, vagrant git-update, that performs all these steps.

切换到不同的版本
Switching to a different version of MediaWiki is far simpler with Git than with SVN. Each of our versions are tracked as branches or tags. In order to switch to one of these, all you have to do is checkout the particular branch or tag you want from within your MediaWiki clone directory: git checkout 或 git checkout 你的更改会自动完成.

使用Git下载MediaWiki扩展

 * List of extensions in git

Download an extension

 *  should be replaced with the name of the extension you want to download, without spaces. For Extension:TitleKey, it would be TitleKey. (case sensitive!)

从Git下载单个扩展

cd /path/to/extensions git clone https: //gerrit.wikimedia.org/r/p/mediawiki/extensions/.git

开发者使用以下命令: git clone ssh:// @gerrit.wikimedia.org:29418/mediawiki/extensions/.git You can view extension source code in Phabricator's diffusion application, and at the URL:

<pre style="white-space: pre-wrap;"> https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/<EXT>.git;a=tree;h=refs/heads/master;hb=master

下载全部扩展
想从 gerrit.wikimedia.org下载所有扩展？键入以下命令:

欲更新扩展，请遵指引：

要跟踪特定分支，请执行：

移除一个扩展
Just remove the extension folder and remove the " " from.

使用Git下载MediaWiki皮肤

 * List of skins in git

从Git下载的MediaWiki 1.24及以后的版本不再包含皮肤.

Follow the exact same procedure as for extensions (described in the previous section), but using  rather than   in all URLs and paths.

详细的皮肤安装指南可以在各自的描述页上找到, 例如Vector： Skin:Vector#Installation.

另见

 * ,从Git下载的备用方法.
 * ,从Git下载的备用方法.