Sergey Ovchinnik
Sergey Ovchinnik

Reputation: 502

Difference between [email protected]:... and https://github.com/...?

I've recently attempted building a project which had various dependencies declared as Github links. The links were a mixture of links to public Github repositories and private Github Enterprise repositories of my company.

Some of the links were in format

https://github.com/project/repo.git

And some were in format

[email protected]:project/repo.git

What exactly is the difference between such formats and which format is intended to be used for what purpose?

Upvotes: 7

Views: 3704

Answers (2)

youness
youness

Reputation: 156

git can operate on a variety of different protocols

http(s) like https://github.com/project/repo.git

It uses the port 443 (or 80 for http), it allows both read and write access, password for auth (like on github it allows anonymous read access but asks a paasword for write).and Firewall friendly (it does not require any infra configuration).

ssh like [email protected]:project/repo.git

It uses the port 22, it allows both read and write access, requires SSH Keys for auth so if you give git your public ssh key, your ssh protocol will use your private key for authentication with git, so you will not need to provide a username password.

with SSH you will not be asked to provide your password each time you use the git push command as the ssh protocol will use you private key for authentication with the repository.

Upvotes: 8

Nesar
Nesar

Reputation: 96

https://github.com/project/repo.git

is HTTPS URL

[email protected]:project/repo.git

is SSH URL

both can be used to do git file transfers but github recommends HTTPS over SSH URLs because These URLs work everywhere--even if you are behind a firewall or proxy.

refer https://help.github.com/articles/which-remote-url-should-i-use/ for more information.

Upvotes: 3

Related Questions