Versioning
Setting up Git on Cloud
Versioning
Setting up Git on Cloud
- Open terminal
- Configure Git
- Set up SSH key
- Add SSH key to GitHub profiles settings
- Add github.com to known hosts
1. Open terminal
- In the left navigation menu, click the Terminal icon.
- 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
- In the terminal, type the following command to set your user name:
git config --global user.name "Your name here"
- 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
-
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 withoutbash
:ssh-keygen -t rsa -C "your_email@example.com" -f ~/.ssh/id_rsa -N ""
-
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
- Open your GitHub profiles settings.
- On the left hand side, click the section called SSH and GPG keys.
- In the top left corner, click a button labeled New SSH key. This will open a new form to create a new SSH key.
- Enter in anything into the input field labeled Title. For example,
mage-cloud-key
. - Under the dropdown labeled Key type, select the
Authentication Key
option. - 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. - Click the button labeled Add SSH key.
GitLab
- Open your GitLab profile settings.
- On the left hand side, click the section called SSH keys.
- 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. - Enter in anything into the input field labeled Title. For example,
mage-cloud-key
. - Under the dropdown labeled Usage type, select the
Authentication
option. - Click the button labeled Add key.
5. Add your host to known hosts
- 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.