- 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
- Open a pipeline
- In the right panel of the screen (aka Sidekick), click on the tab named Terminal.
- Click the terminal (large dark background area), and you should see a blinking 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 "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 "firstname.lastname@example.org" -f ~/.ssh/id_rsa -N ""
If you get the error
cannot execute binary file, then re-run the command above without
ssh-keygen -t rsa -C "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):
It should look something like this:
ssh-rsa alotofcharacters...morecharacters firstname.lastname@example.org
4. Add SSH key to GitHub profiles settings
- 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,
- Under the dropdown labeled Key type, select the
- In the text area labeled Key, paste in the output text you copied after
running the command
cat ~/.ssh/id_rsa.pubin your terminal.
- Click the button labeled Add SSH key.
5. Add github.com to known hosts
- In your terminal, run the following command to add github.com to known hosts:
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
Now you can push your changes to a remote GitHub repository.