Skip to content

设置源登记-Setting Up a Source Enlistment

Enlisting in the Source Code Using Git and Git Extensions

使用Git和Git扩展登记源代码

The Orchard project source code is hosted on GitHub and can be accessed using a Git client. This page explains how to set-up your development environment. This setup allows you to work on the project as a developer, fix issues, build your own site from it or build modules.

Orchard项目源代码[托管在GitHub](https://github.com/OrchardCMS/Orchard),可以使用Git客户端访问。本页介绍了如何设置开发环境。此设置允许您作为开发人员处理项目,修复问题,从中构建自己的站点或构建模块。

When using a distributed source control system such as Git, it's important to understand that the latest check-in on the GitHub repository is not necessarily the one you want to download or sync to as it may be a different branch than the master branch.

当使用像Git这样的分布式源代码控制系统时,重要的是要理解GitHub存储库上的最新签入不一定是您要下载或同步到的那个,因为它可能是与主分支不同的分支。

When synchronizing your enlistment, you will probably want to sync to the master branch. This is the latest stable release. Branches are covered in more detail here.

同步您的登记时,您可能希望同步到主分支。这是最新的稳定版本。分支[在此处更详细地介绍](Contributing-patches#Branches)。

For more information about Git, please read Git Basics, Basic Branching and Merging or Git Extensions user manual.

有关Git的更多信息,请阅读[Git Basics](http://git-scm.com/book/ch1-3.html),[Basic Branching and Merging](http://git-scm.com/book / en / Git-Branching-Basic-Branching-and-Merging)或[Git Extensions用户手册](https://git-extensions-documentation.readthedocs.org/en/latest/)。

Step 1: Install Git Extensions

第1步:安装Git Extensions

Git Extensions is one of many Git clients available. You can access the repository using any Git client. This tutorial explains how to clone the repo with Git Extensions.

[Git Extensions](https://github.com/gitextensions/gitextensions#git-extensions)是许多可用的Git客户端之一。您可以使用任何Git客户端访问存储库。本教程介绍如何使用Git Extensions克隆repo。

Download the latest release directly from GitHub. You have two main options, the Setup.msi and the SetupComplete.msi. You should get the SetupComplete.msi version which comes with some useful extra utilities bundled with it.

直接从GitHub下载[最新版本](https://github.com/gitextensions/gitextensions/releases/latest)。您有两个主要选项,Setup.msiSetupComplete.msi。您应该获得SetupComplete.msi版本,该版本附带了一些有用的额外实用程序。

Open the msi when it has downloaded. Follow the steps to complete the installation:

下载后打开msi。按照步骤完成安装:

  1. Installation Scope Install for all users unless you don't have administrator privileges.

1. 安装范围除非您没有管理员权限,否则为所有用户安装。

  1. Required Software Select MsysGit and KDiff3. You must have a a version of MsysGit installed for Git Extensions to function properly. KDiff is great for comparing the differences between two files or folders. You can optionally install Windows Credential Store for Git.

2. 所需软件选择MsysGitKDiff3。您必须安装一个版本的MsysGit才能使Git Extensions正常运行。 KDiff非常适合比较两个文件或文件夹之间的差异。您可以选择安装Windows Credential Store for Git

  1. Destination Folder Accept the default or select your preferred destination.

3. 目标文件夹接受默认值或选择首选目的地。

  1. Custom Setup The defaults are fine.

4. 自定义设置默认设置正常。

  1. Select SSH Client Choose PuTTY.

5. 选择SSH客户端选择“PuTTY”。

When installation has completed you will find that you have extra Git Ext options when you right click in Windows Explorer:

安装完成后,当您在Windows资源管理器中右键单击时,您会发现有额外的Git Ext选项:

Step 2: Enlist in the Source Code Using Git Extensions

第2步:使用Git扩展登记源代码

In Windows Explorer, navigate to the local directory where you want your copy of the source code to live, right-click and choose GitEx Clone.

在Windows资源管理器中,导航到您希望源代码副本存在的本地目录,右键单击并选择“GitEx Clone”。

In the clone window you have four fields to fill out.

在克隆窗口中,您有四个要填写的字段。

  • In the Repository to clone field type https://github.com/OrchardCMS/Orchard/.

  • Repository to clone字段中输入[https://github.com/OrchardCMS/Orchard/](https://github.com/OrchardCMS/Orchard/)。 *

  • The Destination field will already be filled out with your current directory.

  • “目的地”字段已经填写了当前目录。 *

  • When you paste the repository url it will also fill out the Subdirectory to create field. If you want to change this to a project name you can.

  • 粘贴存储库URL时,它还会填写“要创建的子目录”字段。如果要将其更改为项目名称,则可以。 *

  • Selecting the Branch dropdown will show you all of the current branches. This is loaded from GitHub so it may take a few seconds to load the list. For the latest stable branch select master.

  • 选择Branch下拉列表将显示所有当前分支。这是从GitHub加载的,因此加载列表可能需要几秒钟。对于最新的稳定分支,请选择master *

The rest of the settings can be left as-is. Click Clone.

其余设置可以保持原样。点击“克隆”。

You will not be prompted for your GitHub login and password unless you try to commit changes.

除非您尝试提交更改,否则不会提示您输入GitHub登录名和密码。

Step 3: Building and Running the Orchard Source

第3步:构建和运行果园源

You can build and run Orchard either from the Visual Studio, or using a command-line batch file.

您可以从Visual Studio或使用命令行批处理文件构建和运行Orchard。

Using Visual Studio

使用Visual Studio

Open Orchard.sln from the Git enlistment directory, in ./src. For information on the structure of the Orchard solution, see the source code organization page of this website.

从Git登记目录中打开Orchard.sln,在。/ src`中。有关Orchard解决方案结构的信息,请参阅本网站的[源代码组织](源代码组织)页面。

Hit F5 to build and run the application.

按“F5”构建并运行应用程序。

Without Visual Studio

没有Visual Studio

Build the application from the command-line following the instructions found here: Building and deploying Orchard from a source code drop. You may use IIS or IIS Express to run the application.

按照以下说明从命令行构建应用程序:[从源代码中删除构建和部署Orchard](构建和部署-Orchard-from-a-source-code-drop)。您可以使用IIS或IIS Express来运行该应用程序。

Everyday Git Extensions Use

日常Git扩展使用

The part of Git Extensions you're going to use the most is the Repository Explorer (right-click on the Git enlistment directory from the Windows Explorer to find it, it's called GitEx Browse).

您最常使用的Git Extensions部分是Repository Explorer(右键单击Windows资源管理器中的Git登记目录以找到它,它称为“GitEx Browse”)。

For example, to get the latest changes from GitHub, just click Pull.

例如,要从GitHub获取最新更改,只需单击“拉”即可。

The repository explorer gives you a view of all the branching and merging that has been going on on the server. You can examine each change, read its description and view diffs. You can also right-click a change and update your local repository to it by clicking Checkout revision.

存储库资源管理器为您提供服务器上正在进行的所有分支和合并的视图。您可以检查每个更改,阅读其描述并查看差异。您还可以右键单击更改并通过单击“Checkout revision”更新本地存储库。

You can also filter by branch, which is useful for example if you're only interested in the more stable master branch. Development work is done in both the 1.9.x and dev branches.

你也可以通过分支过滤,这有用,例如,如果你只对更稳定的master分支感兴趣。开发工作在1.9.xdev分支中完成。

Viewing the Source Code Without Enlisting

在没有登记的情况下查看源代码

If you don't want to use Git you can still download the source code for the project. You can download a .zip file of the source code but this means you don't get the advantages of being able to easily clone and update.

如果您不想使用Git,您仍然可以下载项目的源代码。您可以[下载源代码的.zip文件](手动安装-Orchard-zip-file),但这意味着您无法轻松克隆和更新。

Branches

分行

Learn more about the branches on the contributing patches page.

在[贡献补丁页面](Contributing-patches#Branches)上了解有关分支的更多信息。