1

Is it possible to access repository having only public SSH key? The key content looks like

ssh-ed25519 <key> <username> 

I've tried to put the .pub key into ~/.ssh folder but it didn't take effect.

[email protected]: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 

If so, how to setup such connection on Ubuntu?

3
  • The public key must be registered on Github's side. Then you can use the private key to authenticate. Please read docs.github.com/en/authentication/connecting-to-github-with-ssh carefully Commented Oct 11, 2022 at 6:55
  • That means that public key shall be stored on server side (the one I'm trying to connect), and client (which from I'm trying to connect) shall have private key, and there is no other way to use SSH? Commented Oct 11, 2022 at 7:00
  • Simply said; in SSH the authenticating party proves its identity by having the private key to which a pre-configured public key belongs. Hence the "public" and "private" terminology. Commented Oct 12, 2022 at 6:12

1 Answer 1

2

That means that public key shall be stored on server side (the one I'm trying to connect), and client (which from I'm trying to connect) shall have private key, and there is no other way to use SSH?

No, there is not: that is how GitHub will authenticate you. It will use your public key associated to your profile.

So you need to copy the ~/id_ed25519.pub content to your GitHub profile SSH settings.
The ~/id_ed25519 private key, being private, must remains on your computer.

So, to share a repo access I should provide to a teammate private key (and key pass), right?

Most certainly not, as the private key provided would not be... private.

Said teammate should generate their own private/public key, allowing GitHub to authenticate them.

Once that is done, you can invite your teammate as collaborator to your repository. Then they will have push access to the repository.

Sign up to request clarification or add additional context in comments.

2 Comments

So, to share a repo access I should provide to a teammate private key (and key pass), right?
@VictorRomaniuk I have edited the answer to address your comment.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.