.jpg)
#web
Having a backup of your code is very important, and of course, the goal of the task should always be to find the easy way to do repetitive tasks.
Oh, wait. We can use git for that. We will use GitHub for our repo, but I have used Bitbucket and I can not tell if one is better than the other. Now, connecting with SSH is something complicated, and to be completely honest I am not a big fan of how they have made the interface.
You need to create your own SSH key, you need to create your config files, you need to change ownership of the folder, etc. But I guess it is not meant to be used by the mainstream. So let's start with our tutorial.
SSH key
After you create a repository on GitHub you will need to navigate to the account drop-down menu right after you click on it select Settings, and on the Settings page choose SSH and GPG keys in the left menu.
Here you will create your public_key that you will use to perform git actions on GitHub. You can name your public key however you want. But to create SSH we will need to use a Linux console, open your system console, and type the command ssh-keygen, and it will prompt you to input your phrase word.
You will need to remember this phrase word since you will be asked to enter it on every git connection to GitHub. You should create keys in ~/home/.ssh/ folder, it is a hidden folder in your /home directory. This is how it may look.
You can check your key with the cat command.
Copy this key and paste it on GitHub and create your public SSH key. After this, we need to create a config file in the ~/.ssh/ folder. As we create our keys outside ~/.ssh we need to transfer them to that folder, you can use console mv or cp command, or just move them with the mouse.
Now we need to create a config.txt file, you can use an ordinary text editor or nano editor in the console. The file should look like this.
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/my_ssh_key
IdentitiesOnly yes
Change the name of the IdentityFile to your file. Never share your SSH key, always use *.pub file on another end. If this does not work you will need to check your permissions on ~/.ssh. See what chmod best suits your security standards, code 700 probably will work just fine, and set ownership with chown.
chown -R dave:dave .ssh/
chmod 700 .ssh/
chmod 600 .ssh/*
Testing
To connect to your repo after you have initialized git try the following commands as seen on the photo, at this point you will be required to enter the phrase word you have used upon SSH key creation.
Commit often and stay connected.
[root@techtoapes]$ Author Luka
Login to comment.