2

If Some one has shared his private repository to me than whenever I tries to push on that private repository it always asks me for username and password. But I have already added my private key in ssh-keys on my personal repository using How To Add SSH Key

Now I can manage to push on my personal repository but not on other's private repository shared to me using ssh private key. Why? Is there a way to push on private repository with out adding my private key to other user's ssh keys.

Braham Shakti
  • 1,408
  • 4
  • 22
  • 39
  • possible duplicate of [Git push requires username and password](http://stackoverflow.com/questions/6565357/git-push-requires-username-and-password) – tripleee Feb 02 '15 at 10:49

1 Answers1

4

Asking for the username and password means that you are using an https url for that repo.

https://username@github.com/anotherUsername/aGitRepoName.git

You should use the ssh url (git@github.com:USERNAME/REPOSITORY.git), which requires for your public key to be added to that private repo, making you a collaborator.
You would never need to add your private key anywhere, since it is... private.

See:

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250