How to move your project from Linux/Mac to a Linux server using SCP

This is purely for the comparison. My recent post was about the same thing but on Windows. Nasty business. And here is a guide for Linux/Mac – it is so much easier.

The difference is that here I use SCP, and for Windows I used SFTP. That is because even after generating the keys with PuTTYgen I could not figure out how to “install” them into PuTTY to use a command pscp -scp (the PuTTY scp) in the Command Prompt. That and the fact that my teammate was more comfortable with GUIs, so I picked the first thing that worked.

Generate a public SSH key

With a command:

ssh-keygen -t rsa

Copy the public key

cat ~/.ssh/id_rsa.pub

Install it on the server

By adding it to this file (a new line, but don’t add empty lines):

nano ~/.ssh/authorized_keys

Move files from one directory to another

If you have your public SSH key on the server, using this command you can transfer files to the server.

scp -r <source> <user>@<server>:<destination>

source – the absolute path of your project folder on your computer

destination – the absolute path of the folder where you want to copy the files

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.