如何使用企业 git 配置 GitHub 的 Atom 编辑器

How to configure GitHub's Atom Editor with enterprise git

我刚刚在我的 Windows 机器上下载了 GitHub 的 Atom 编辑器,现在正在尝试将我的 Atom 编辑器与 git 企业存储库集成,例如:

https://git.company.com/abc.git

以便我可以克隆、进行更改并签入。

我该如何实现?

虽然 Atom 是由 GitHub 积极开发的,但它与 github.com 或由 GitHub 托管的项目没有紧密耦合。我强烈建议使用扩展内置 git 支持的 git-plus package 显着允许除其他事项外:

  • 分行管理
  • 添加文件
  • 承诺
  • 推拉

据我所知,使用 Git Plus 唯一不能做的就是克隆一个新的存储库,但是 git-clone package:

支持克隆

虽然此屏幕截图显示的是 GitHub 网络界面,但实际上您可以使用任何 git 存储库 URI。

为了这个答案的目的,我假设您有一个可用的 git 存储库,并且已经在 Atom 中安装了 git-plus and the git-clone packages

配置Git克隆

Learning Objective: Configure Atom Editor and the Git Clone package to clone your git repositories in a sensible location.

  1. 第一步是配置Git克隆,按Ctrl-,.[=96打开设置=]
  2. 单击左侧的 Packages 找到 git-clone
  3. 单击 git-clone 包的 Settings 按钮,这将打开设置页面。
  4. Target Directory 设置为适合您的操作系统和设置的值。我强烈建议这是一个快速的本地驱动器,例如 SSD。

克隆存储库

Learning Objective: Get a copy of the code from a central repository onto your development machine using Atom Editor ant the Git Clone package.

  1. 首先确定合适的 git URL,我将使用 GitHub URL 但这可以是任何 git URL.

     git@github.com:RichardSlater/activate-power-mode.git
    
  2. 从Atom按Ctrl-Shift-P打开在命令面板中输入:Git Clone to select Git Clone: Clone.

  3. 从上面的第一步输入 git URL 并按 Enter

完成上述三个步骤后,您将获得 git 存储库的克隆并打开一个新的 Atom window。

做一些改变

Learning Objective: See how to use Atom Editor and the Git Plus package to make some changes to your code and push these back up to the central repository.

  1. Select 左侧 TreeView 中的文件之一,在本例中我将使用 lib/activate-power-mode.coffee.
  2. 我们要将 Line 32 上的油门限制从 25 更改为 50 - 继续进行此更改:

    @throttledSpawnParticles = throttle @spawnParticles.bind(this), 50, trailing: false
    
  3. 保存这个文件,注意TreeView中文件的颜色已经变成了橙色,状态栏的右边会有一个git状态信息:

    + 1, -1
    
  4. 现在我们需要添加这个文件,按Ctrl-Shift-[再次打开命令面板=66=]P 然后键入 git add,按 enter 以暂存当前文件。

  5. 将显示一条绿色消息,表明文件已成功添加。
  6. 好的,让我们继续为这个文件创建一个提交;再次打开命令面板并键入 git commit,将打开一个新缓冲区,您可以在其中键入提交消息。继续并输入提交消息。
  7. Ctrl+S保存消息,关闭提交消息缓冲区并创建提交。
  8. 打开命令面板并键入 git push,最终将此提交推送到您的存储库。

您现在应该已经从 Atom 编辑器对中央 git 存储库进行了更改。