Shezan
Shezan

Reputation: 515

Can I use SSH and HTTPS both for single git account?

If i use SSH then I have to download git repository using git ssh but if I use HTTPS then https is the way.

Can I download those git repo using both way for a single account?

Upvotes: 1

Views: 1016

Answers (1)

VonC
VonC

Reputation: 1323463

The account is what the remote hosting service will use to authenticate you and determine if you have the right to access the remote repository you want to clone.

  • for HTTPS, it will be the username/password
  • for SSH, it will be the public key published to your remote account profile setting (while the actual remote user for an SSH session is almost always a technical account like 'git': git@remoteServer:Me/MyRepository)

If the remote hosting service supports both protocols, the same user account can clone using either one of them.


If you are using HTTPS, make sure:

  • to create a PAT (Personal Access Token) that you will use as password
  • to check or set a credential helper (to cache those credentials)

That is:

git config --global credential.helper

I recommend setting it to manager-core, using the Microsoft Git Credential Manager (GCM) (cross-platform).
It is already packaged/set with Git For Windows for instance.

Upvotes: 1

Related Questions