Search code examples
gitamazon-web-servicesgithubservercloud9

SSH vs Git Clone


At my job, we are have a (EC2) Cloud9 environment setup and we use VSCode to ssh into the server, and then we can work on the projects/repos.

I'm curious what the difference is if i just 'git clone [project]' locally in my VSCode, because I still have access to the repos, and can still pull/push commits.

What is the difference? Are there pros and cons to each?

Also my understanding of what ssh is limited even after looking at some docs so I'm open to missing some key information about what the ssh protocol is doing.

Thank you


Solution

  • Both are valid options. SSH is the secure shell protocol, which allows you to make a terminal (and sometimes graphical) connection to another machine to run programs on, or copy and modify files from, that machine. This connection is securely encrypted so that others cannot read or tamper with it.

    Which machine you choose to work on, whether it's local or remote, depends on various factors. In many cases, it can be more convenient to have a local copy and work on it there. In general, each individual user should have their own repository to work with, so if the remote server has just a single repository, working locally would be better.

    However, in some environments, having company code on a desktop or laptop is not allowed, and that code must remain within the company network. I have worked at such a company, and if your company policy requires that, then you should honor it, and work on the remote server. In such a case, you may be able to use SFTP, which is a file transfer protocol that runs over SSH, to edit files on the remote server with an editor on your laptop or desktop. This is often allowed, even when local code copies occur, and in many cases can be just as convenient as working locally provided you have a good Internet connection.