Note: This feature is not yet available to all Wix Editor users.
Git Integration & Wix CLI allows you to write, test, and publish code for your Wix site locally on your computer. This article explains how to set up Git Integration & Wix CLI by connecting your site to GitHub, cloning your site's GitHub repository to your computer, and installing the Wix CLI.
To write your site's code locally from your computer, first create a GitHub repo to store your site's code and connect it to your site.
Important:
- You can't connect your site to GitHub if you have Velo Packages set up on your site. This feature isn't supported when using Git Integration & Wix CLI. However, you can connect your site to GitHub if you have npm Packages installed on your site.
- Once you connect your site to GitHub be careful not to delete your site's repo or revoke the Velo app's access to this repo. These actions may cause your site's GitHub connection to stop working even if you restore the repo or reinstall the app.
Before getting started, make sure Velo Dev Mode is enabled (Wix Editor), or if you haven't already done so, click and then Start Coding (Wix Studio).
-
Go to the GitHub Integration section of your editor:
- Wix Editor: Click the GitHub Integration
icon in the Velo Sidebar and then Connect to GitHub.
- Wix Studio: In the Code sidebar, click GitHub then Connect to GitHub.
- Wix Editor: Click the GitHub Integration
-
Click Continue.
-
Click Sign In.
Follow the prompts to sign in to your GitHub account and authorize Velo to create a new repo for you.
-
Choose an owner and enter a name for the new repo to connect to your site. Optionally, you can add a custom description as well. Click Create.
-
Click Install to start installing the Velo GitHub app on your new repo.
This app allows your site to communicate with GitHub. You may need to authenticate your identity in GitHub before continuing.
-
Make sure that both Only select repositories and your new repo are selected. Click Approve and Install.
-
Copy the displayed terminal commands. You need them for the next section of the setup.
-
Click Close.
Your repo name and default branch are displayed in the GitHub Integration panel.
Once you connect your site to GitHub, your editor enters read-only mode.
Once your site's repo it set up, you can clone it to your computer and install the Wix CLI. The commands used in this procedure accomplish the following:
- Clone your site's repo to your computer.
- Install the repo's dependencies.
- Install the Wix CLI globally on your computer.
Before getting started, make sure you have the following things installed:
- Git
- Node, version 14.8 or later.
- npm or yarn
- An SSH key added to your GitHub account.
To set up your local environment, do the following:
-
Open the terminal on your computer.
-
Navigate to the directory where you want to store your repo's files.
-
Run the commands you copied down in the previous section. Depending on your computer's setup, you may need administrator privileges to run the commands.
To see the commands again, open your site's editor and click Local Dev Setup.
The default commands use npm as the package manager for installations. You can also use yarn to manage packages. To do this, make the following changes:
- Change
npm install
toyarn install
. - Change
npm install -g @wix/cli
toyarn global add @wix/cli
.
After the installation, the Local Editor opens in your default web browser.
- Change
-
Open the repo in your favorite local IDE to start writing code.
You're ready to start writing your site's code. Learn more about the file structure of your site's repo, testing your code with the Local Editor, and using the Wix CLI.