Versioning
Setting up Git on Cloud

  1. Open terminal
  2. Configure Git
  3. Set up SSH key
  4. Add SSH key to GitHub profiles settings
  5. Add github.com to known hosts

1. Open terminal

  1. In the left navigation menu, click the Terminal icon.
  2. Click the terminal (large dark background area), and you should see a yellow cursor. You can start typing once that cursor appears.

2. Configure Git

  1. In the terminal, type the following command to set your user name:
    git config --global user.name "Your name here"
    
  2. In the terminal, type the following command to set your email:
    git config --global user.email "your_email@example.com"
    

Optionally, you can configure Git further with these commands:

git config --global color.ui true
git config --global core.editor emacs

3. Set up SSH key

  1. In the terminal, type the following command to create an SSH key on the machine that’s running Mage:

    bash ssh-keygen -t rsa -C "your_email@example.com" -f ~/.ssh/id_rsa -N ""
    

    If you get the error cannot execute binary file, then re-run the command above without bash:

     ssh-keygen -t rsa -C "your_email@example.com" -f ~/.ssh/id_rsa -N ""
    
  2. Run the following command and copy the public SSH key (it’ll be used

    the next section):

    cat ~/.ssh/id_rsa.pub
    

    It should look something like this:

    ssh-rsa alotofcharacters...morecharacters your_email@example.com
    

4. Add SSH key to your profiles settings

GitHub

  1. Open your GitHub profiles settings.
  2. On the left hand side, click the section called SSH and GPG keys.
  3. In the top left corner, click a button labeled New SSH key. This will open a new form to create a new SSH key.
  4. Enter in anything into the input field labeled Title. For example, mage-cloud-key.
  5. Under the dropdown labeled Key type, select the Authentication Key option.
  6. In the text area labeled Key, paste in the output text you copied after running the command cat ~/.ssh/id_rsa.pub in your terminal.
  7. Click the button labeled Add SSH key.

GitLab

  1. Open your GitLab profile settings.
  2. On the left hand side, click the section called SSH keys.
  3. In the text area labeled Key, paste in the output text you copied after running the command cat ~/.ssh/id_rsa.pub in your terminal.
  4. Enter in anything into the input field labeled Title. For example, mage-cloud-key.
  5. Under the dropdown labeled Usage type, select the Authentication option.
  6. Click the button labeled Add key.

5. Add your host to known hosts

  1. In your terminal, run the following command to add your host to known hosts:
    ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
    

Change the host to gitlab.com if you are using GitLab.


Now you can push your changes to a remote GitHub repository.