Git for Shared Development Environments

Downloads57
Subscribe
8
Bookmark
7
This application is not supported by InterSystems Corporation. Please be notified that you use it at your own responsibility.
Details
Releases
Reviews
Issues

What's new in this version

Fixed:

  • Handle UTF-8 characters in git commit messages

git-source-control

Server-side source control extension for Git on InterSystems' platforms

Prerequisites/Dependencies

Installation and Setup

  1. Load this repository into IRIS from the community package registry.
    zpm "install git-source-control"
    
  2. Configure settings by running the following method and answering the prompts:
    d ##class(SourceControl.Git.API).Configure()
    
  3. If using VSCode: Set up isfs server-side editing. First, save your current workspace in which you have the code open. Then, open the .code-workspace file generated by VS Code and add the following to the list of folders:
    {
        "name": "<whatever you want the folder to show up as in the project explorer view>",
        "uri": "isfs://<instance_name>:<namespace_name>/"
    }
    

Basic Use

Studio

Add a file for tracking by right-clicking on it in the workspace/project view and choosing Git > Add. This same menu also has options to remove (stop tracking the file), discard changes (revert to the index), or commit changes.

You can browse file history and commit changes through a user interface launched from the top level Git > "Launch Git UI" menu item. There is also a page for configuring settings.

VSCode

The same right click menus as in Studio live under "Server Source Control..." when right-clicking in a file (in the editor) or on a file when exploring an isfs folder. The top level "source control" menu is accessible through the command palette or the source control icon in the top right of the editor.

Notes

Mapping Configuration

To specify where files should go relative to your repository root, add mappings via the "Settings" menu item. A mapping has three parts:

  • The file extension to use: e.g., CLS, MAC. As a special case for web application files, use "/CSP/" as the mapping.
  • A filter on the files of that type (e.g., a package name or web application folder)
  • The folder relative to the repo root that contains the item. This controls behavior for import and export.

This might look like:

Example of mapping configuration

Security

If you want to interact with remotes from VSCode/Studio directly (e.g., to push/pull), you must use ssh (rather than https), create a public/private key pair to identify the instance (not yourself), configure the private key file for use in Settings, and configure the public key as a deploy key in the remote(s).

Setting up multiple GitHub deploy keys on one machine

Assuming you have the local and remote repositories created,

  1. Create your key pair using ssh-keygen.
  2. Add the public key to GitHub.
  3. You can try setting remotes with the URL your remote repository provides, but sometimes your firewall might cause issues and refuse the SSH connection. In that case, I've found that changing the remote URL to the following is helpful: ssh://git@ssh.github.com:443/<repo_owner>/<repo_name>.git
  4. Copy the private key into 2 locations
    1. <path to IRIS Instance storage>\mgr\<private key>
    2. ~/.ssh/<private key>
  5. Make sure to set the owner and permissions for the private key correctly. For Windows, go to where the private key is stored in IRIS and edit the owner to be the admin, disable inheritance and remove all access to the key to every user except the admin.
  6. In git source control settings, set the path to the private key as the one in IRIS.
  7. Change the default ssh command in the git config for your repository as: git config core.sshCommand 'ssh -i ~/.ssh/<private key name>'
  8. Test the refresh button for the remote branches on the WebUI, fetch from the source control menu in Studio or VS Code, and git fetch in Git Bash. All 3 should work without any issues.

During Development

⚠️ Whenever any code in this project is updated outside the server (e.g. after every git pull), you have to run zpm "load <absolute path to git-source-control>". Otherwise, the changes won't be reflected on the server. However, if you load git-source-control via the InterSystems package manager and run git pull via the extension itself with the default pull event handler configured, it'll just work.

ZPM installation
zpm "install git-source-control"
Rating
0 (0)
Category
Developer Environment
Works with
InterSystems IRIS
Tags
Info
Version
2.0.4
Last updated
2022-10-05
Repository
Open
Documentation
Open
License
Link