Answer the question
In order to leave comments, you need to log in
How to work with GIT over SSH on a VPS?
Hello.
Previously used only shared hosting services.
Today I created a VPS droplet on digitalocean, created SSH keys on the laptop and tied the public key to the droplet.
There is a Node.js project on the laptop that needs to be uploaded to this very new droplet.
For test purposes, I created an empty repository on a laptop and an empty repository on a VPS, and I just can’t catch up with how I can push to a VPS or pull from there.
I tried it on laptop
git remote add origin ssh://[email protected]:/projects/project
git push origin master
- got:Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
git remote add origin
over SSH?
Answer the question
In order to leave comments, you need to log in
Understood. Everything is quite simple.
I enabled authorization to the server with a password, then reset the key pair that I generated when creating the droplet using PuTTY according to the digitalocean manual , after which I generated new keys using another manual from them , in a simpler and more adequate way. I sent them, as written in the manual, to the server, logging in with a password. Now connecting to the server and repository via SSH is successful.
The main thing, which I didn't guess before, is that the keys should be stored in C:\Users\user\.ssh
Now you can disable password authorization.
You confused the server key with the repository key.
The repository key must be on the server itself, not on the local computer.
Especially in any way
Do everything through github
Or raise some kind of your own git server, gitolight or gitlab
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question