Welcome! The “How to” series continue. Today, we busted huge problem with GitHub: clone private repository to VDS.
Objectives of the article
- Show one of the easiest ways to clone your private GitHub repository;
- Train your console skills;
First, generate SSH key on your VDS:
Choose any name, if you want. I use default name
Generating public/private rsa key pair. Enter file in which to save the key (~/.ssh/id_rsa): <file name> Enter passphrase (empty for no passphrase): <password> Enter same passphrase again: <password again> Your identification has been saved in ~/.ssh/id_rsa. Your public key has been saved in ~/.ssh/id_rsa.pub. The key fingerprint is: SHA256:Hs516tDZPzK0b+/cQhNiyWZUJwnaeDqOShMBBQidhBX firstname.lastname@example.org The key's randomart image is: +---[RSA 2048]----+ |.o.o **E= | |=*ooo.. | | o.+ . | | = . | | o . S ..| | o..o .......| | ..** o....o. | | oo o+o==.| | .o.+. . o=| +----[SHA256]-----+
Next step, create SSH config:
sudo cat >~/.ssh/config <<EOL Host my_project Hostname github.com User git IdentityFile ~/.ssh/id_rsa EOL
And now, copy public key to clipboard:
sudo cat ~/.ssh/rsa_key.pub
Go to your GitHub repository settings. Add copied public key to
Deploy Keys section.
Don’t forget check
Allow write access. That’s it!
Let’s clone it!
You may git clone your private repository on VDS:
sudo git clone my_project:<user>/<repo>.git
How to update?
For update code from your repository, type into project directory:
- What’s console command may generate SSH key?
- What does the
catcommand on console?
- What happens, if you run command on console without