Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

maparfitt's avatar

How do I "ssh into sites directory"?

I'm fairly new to Laravel, but I did manage to get my site up and running on Digital Ocean using Forge. But then my git repo got a little messed up and I'm no longer able to deploy changes. The deploy error reads

"error: Your local changes to the following files would be overwritten by merge: .env Please commit your changes or stash them before you merge."

The Forge docs explain:

"Please Commit Your Changes Or Stash Them Before You Merge

This error occurs when files within the site directory have changed and will be overwritten by the fresh deploy.

To fix this, you should SSH into your sites directory and run:

git reset --hard && git clean -df

You should also take a look to see why files in your project have changed."

Here's my problem: I can ssh into my server, but I don't see anything in the files that would accept git commands. Presumably, I've misunderstood what the docs mean by "SSH into your sites directory." Can someone help me understand how I should proceed?

Thanks in advance.

0 likes
3 replies
srasch's avatar

If you are logged in via ssh you can cd into your site by „cd default“ (if you have not set a site name/domain) or „cd www.yourdomain.com“.

Before, you can show all directories by typing ls -a.

Hope it helps.

Brian Kidd's avatar

@maparfitt you can ssh using:

ssh -i <path to your private key> forge@<server ip address>

Once you are in, you'll be in the /home/forge directory. You can then cd into the site directory using:

cd <your site>

This may be unrelated but seeing .env worried me. Hopefully you know you shouldn't commit .env to your source code - your environment variables can be manage in Forge by selecting your site and then "Environment" in the left navigation.

You need to cd into your site/project and then run the git command.

maparfitt's avatar

Thanks @srasch and @briankidd. I think I get it and will give this at try. Yeah, .env is in gitignore -- but that's part of what got messed up temporarily. Long story -- and I don't think it's going to be a problem once I resolve this deploy issue.

Please or to participate in this conversation.