How to append authorized_keys on the remote server with id_rsa.pub key
Adding an authorized key could be one-lined this way (use double-quotes so it's interpreted before sent):
ssh user@server "echo \"`cat ~/.ssh/id_rsa.pub`\" >> .ssh/authorized_keys"
ssh: adding private key to ssh-agent before copying public key to remote server
The "Adding your SSH key to the ssh-agent" documented on GitHub (same on GitLab) is only there if you generate a private SSH key protected by a passphrase (meaning, encrypted)
The idea is that, for a private SSH key used for authenticating to a remote public service like GitHub or GitLab, it is better to have an encrypted key, which makes it less dangerous if said key is leaked.
This is different for a private SSH key used inside a LAN (in your local network): using a passphrase is still a good idea but not mandatory: if the SSH key leak, you still need access to the LAN in order to use it.
Adding public SSH key to a git repository
server should be:
- the remote user account gituser which created the bare repo
- the remote server hostname or IP address where the repo was created.
That means server:~gituser/.ssh/authorized_keys
will receive Tom public SSH key.
From Tom's workstation, you can add the remote URL to your local repository:
git remote add origin gituser@serverName:/home/gituser/project.git
And push to it.
Related Topics
Srlua Makefile Error Lua.H No Such File or Directory
How to Grep for Strings with Special Characters Like []
Posix_Fadvise(Willneed) Makes Io Slower
How to Sort Numbers in a Qtreewidget Column
Ffmpeg Concat and Scale Simultaneously
How to Handle Bash with Multiple Arguments for Multiple Options
Passing an Array as Command Line Argument for Linux Kernel Module
Tar Command Changing The Owner:Group While Extracting
How to Suppress Warnings in Qt Creator
How to Set Folder Permissions for a Particular Container on Elastic Beanstalk
Check The Output of "Make" and Exit Bash Script If It Fails
Create Infinite Looping Repeating File Cat in Linux/Bash
How to Package Mono Applications for Debian/Ubuntu
Core Dump of Multithreaded Application Shows Only One Thread
How to Delete All Files Starting with ._ from The Shell in Linux