Step 1, Get started setting up an environment
SSH keys provide continuous access to GitHub without entering your credentials for every code commit and push. This is a one-time setup that was covered previously in this guide when setting up a Magento workspace.
If you have already set up SSH keys, continue to Step 2, Clone the project. If you need to set up SSH keys, continue with the steps outlined below.
Set up SSH
You must create an SSH keypair on every machine and workspace you and your team expect to work with and access Magento Enterprise Cloud Edition and GitHub branches. The SSH keys connect you to GitHub to manage branches and push code without having to constantly supply your username and password. You can add multiple SSH keys to GitHub per each workspace you use.
The SSH keys require the following:
- Set up SSH keys as the Magento file system owner.
- Create the keys using the email address used for the GitHub account.
For more information on SSH keys, see the following:
Locate an existing SSH keypair
An existing SSH keypair is typically located in the
.ssh subdirectory of the user’s home directory. This folder is hidden and may not display in the file manager or finder unless configured to display hidden files and folders.
You can quickly verify if you have SSH keys by entering commands using terminal access.
To check for SSH keys, enter the following command:
If you have SSH keys, a directory listing is displayed similar to the following:
id_rsa id_rsa.pub known_hosts
If you don’t have SSH keys, you need to generate the keys for adding to your Magento ECE account and GitHub account. See Create a new SSH keypair.
Create a new SSH keypair
ssh-keygen command to create an SSH keypair.
ssh-keygen is typically installed on Linux systems.
To create an SSH key pair:
The command syntax follows, entering the email used for your GitHub account:
ssh-keygen -t rsa -C "email@example.com"
GitHub also uses the key length
-b 4096in the command. Follow the prompts to complete the key.
When prompted to “Enter a file in which to save the key,” press Enter to save the file to the default location. The prompt displays the location.
When prompted to enter a secure passphrase, enter a phrase to use like a password. Make note of this passphrase. You may be requested to enter it depending on tasks you complete using a terminal during development.
After creating the SSH, start the ssh-agent:
For Mac or Linux:
$ eval "$(ssh-agent -s)" For Mac, you may also want to edit the `~/.ssh/config` file to automatically load keys into the ssh-agent and store passphrases in your keychain. Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_rsa
$ eval $(ssh-agent -s)
Add the SSH key to the ssh-agent. If you used a different name for the key file name, replace
id_rsawith that file name.
For Mac or Linux:
ssh-add -K ~/.ssh/id_rsa
Add your SSH key to your GitHub account. The instructions include Mac, Windows, and Linux.
Test the SSH keys
After adding the SSH keys, test the SSH connection to GitHub:
In the terminal, enter the following command:
ssh -T firstname.lastname@example.org
You may see a warning that the authenticity of the host can’t be established followed by an RSA fingerprint. Enter
If successful, you should receive a success message. If you receive a permission denied error, see Error: Permission denied (publickey) troubleshooting on GitHub.
Add a public SSH key to your Magento account
You can add SSH keys to your account in any of the following ways:
- Using the Magento Enterprise Cloud Edition CLI
- Using the Magento Enterprise Cloud Edition Web Interface
Add a key using the CLI
To add an SSH key using the CLI:
If you haven’t done so already, log in (or switch to) the Magento file system owner to the server on which your SSH keys are located.
Log in to your project:
Add the key:
magento-cloud ssh-key:add ~/.ssh/id_rsa.pub
Add a key using the Web Interface
To add an SSH key using the Web Interface:
Copy your SSH public key to the clipboard.
If you don’t already have SSH keys on that machine, see GitHub documentation to create them.
Using the link in your welcome e-mail, access your Magento Enterprise Cloud Edition account.
Log in to your project using Bitbucket, GitHub, Google, or a user name and password.
In the upper right corner of the page, click the Account Settings tab as the following figure shows.
Expand SSH Keys.
On the next page, click Add a public key as the following figure shows.
Follow the prompts on your screen to complete the task.
Set global Git variables
Set required global Git variables on the machine to commit or push to a Git branch. These variables set Git credentials for accessing your GitHub account.
To set variables, enter the following commands on every workspace:
git config --global user.name "<your name>" git config --global user.email <your e-mail address>
For more information, see First-Time Git Setup