I use the Force.com migration tool and git in my daily workflow for Salesforce development and recently tried setting up my local environment on the Linux subsystem that comes with Windows 10.


Step 1: Install Java (JDK)

First update the package index

sudo apt-get update

Then, install the Java Development Kit (JDK)

sudo apt-get install default-jdk

Check that Java is installed

java -version

 Step 2: Install Ant

Update the package index and install ant

sudo apt-get update
sudo apt-get install ant

Check that Ant is installed

ant -v

Step 3: Add the Force.com Migration Tool

The Force.com Migration Tool is basically a jar file that adds functionality to Ant and enables the ability to retrieve and deploy metadata to/from Salesforce environments.

There are a couple of options for adding the Force.com Migration Tool:

  1. Download and add the jar file to the directory where Ant is installed. Save the file in the lib folder within the Ant directory. For solo developers or small teams this might be an easy way to get started. The path to that folder in my Linux subsystem is: /usr/share/ant/lib
  2. Add the jar file to the git repository and specify the location of the jar file in each Ant command. This works well for multi-developer teams. The jar file needs to be updated with each Salesforce release and this is good way to make sure all developers working on a project are using the same version of the metadata API when retrieving and deploying metadata.

Step 4: Create SSH key and add to Git repository

Connecting to a Git repository with an SSH key will remove the need to enter the username and password when connecting to your online repository.

First check for existing SSH keys

cd ~/.ssh

If there are existing keys, copy the contents of your public key file

cat ~/.ssh/id_rsa.pub

If you see “No such file or directory”, then there aren’t existing keys. Generate a new key

ssh-keygen -t rsa -C "your_email@example.com"
  • Press “Enter” on your keyboard to accept the default location
  • Enter a passphrase and re-enter when prompted

In your terminal window, display and then select and copy the contents of your public key file.

cat ~/.ssh/id_rsa.pub

Follow the instructions provided by your online git repository to add the SSH key to your account. Below are links to SSH instructions and troubleshooting tips for major online git repositories:

You should be all set to start working with files from a Salesforce environment or a hosted git repository!


Below are a few additional resources you should review and understand before working with the Linux subsystem on Windows.


Leave a Comment

Your email address will not be published. Required fields are marked *