0

My friend created a server and I tried to get the repository on local machine using this command:

git clone ssh://[email protected]:10022/aaa/bbb.git

However, I get this error message:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

and then he told me to login the git and give me: user name, email and password.

How can I login the git? Thank you very much.

3
  • 1
    Did you added a SSH key to your gitlab account? Do you have permissions on the project? It's hard to just guess whats wrong! Otherwise just ask your friend? Commented Feb 10, 2020 at 12:36
  • @0stone0 it may not be a gitlab server. It’s quite possible to set up an independent standalone git server. OP, have either of you read this section? It’s considered “better” for you each to have an account that allows you to clone from the server. Commented Feb 10, 2020 at 13:09
  • The problem is that he forgot to add my public key to the server. The problem is now fixed! Thank you! Commented Feb 11, 2020 at 9:09

1 Answer 1

1

To clone anything from git, you have to register on github/gitlab (depending where your friend has his git repo), then generate ssh key on your laptop/computer, like described here: https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent. Add public ssh key into your account on github/gitlab (depending where your friend has his git repo). And as a last step - to configure your git on laptop/computer:

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

Here is more information: https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

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

2 Comments

what if my ssh key deleted ?
@DevangHingu you can generate a new ssh key and add a new one into github/gitlab, also remove the old one. Also if you have multiple laptops, you can have multiple ssh keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.