Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to use Git, with HTTPS or with SSH?

What is the safest way to use services like Github and Bitbucket? What are the differences between using HTTPS versus SSH?

Is there a difference in the form of the git clone command? For example,

git clone [email protected]:nsf/godit.git

versus:

git clone https://github.com/nsf/godit.git

I'd like avoid problems such as the one described here: Troubleshooting git push - it asks for a user/pass

like image 360
omar Avatar asked Mar 23 '26 23:03

omar


1 Answers

The differences are mainly in the way authentication is done: for SSH, you'll use the keys to authenticate, and HTTPS will use username/password.

Note that to use SSH, you'll need to have write access to a repository, whereas HTTPS can be used for any type of a repository. Here's a useful help page with more details.

To avoid having to re-enter the password with HTTPS authentication, see this article.

like image 72
Alex Yarmula Avatar answered Mar 26 '26 16:03

Alex Yarmula