Question

How can I access droplet files via ssh and what is the cause of files suddenly missing?

Posted June 3, 2021 83 views
DigitalOcean Droplets

Hi, recently we pushed to our server from git. When we tested the site, some files are missing. These files are part of the gitignore so they should not be affected even if they get deleted from local git repo. What could be the possible reason for this?

Also, I would like to ask if I can access our droplet files via ssh? I would like to download certain files from previous droplets. I do not have access to the control panel since I am only the developer. But I have the root access, is this sufficient to download the files from droplets?

Appreciate your help. Thank you.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

The answer regarding downloading some files as a root user from the droplet.

As per my understanding, you wanna download some files from the previous droplets. There can be a simple strategy to do so if you have access to the droplet.

What you can do is generate an SSH key on your droplet and then add that SSH key to your GitHub account. After that create a private repo and download it on your droplet. Transfer all the necessary files to the repo and push that repo to GitHub.

In this way, you can get the necessary files from your droplet to a private GitHub repo. Also with this approach, you can add and remove files from the repo anytime according to your need.

Hi there @analizabongat,

If this is a fresh new deployment, the files might have never been there. For example, if it is an npm project, the node_modules folder would not be there by default as it will be ignored by the gitignore as you mentioned, you would need to run npm install.

If the files were there and then they were gone all of a sudden, it is quite possible that either someone deleted them manually or if you have some kind of CI/CD pipeline, the automated deployment might have failed. If it is the latter I could suggest checking the CI/CD tool that you are using and going through the logs for more information.

Regarding accessing the files, what you could do is to use SFTP with Filezilla. That way you will be able to upload and download new files directly:

https://docs.digitalocean.com/products/droplets/how-to/transfer-files/

Hope that this helps.
Regards,
Bobby