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

clkline's avatar

First project will not deploy, composer error?

I am very stuck. I am trying to deploy my class project to Forge, but it's throwing an error that isn't covered in any documentation that I've been able track down. I just signed up for this a few hours ago but it's kicking my tail.

This is the message:

We had trouble connecting to your server. Typically, this means there is a problem with the SSH keys on the server. Or, your server may be prompting for a password when Forge attempts to SSH in as the root user.

Error Output

From github.com:FaithInMotion/capstone
 * branch            production -> FETCH_HEAD
Already up-to-date.
Composer could not find a composer.json file in /home/forge/default
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

I am trying to follow this tutorial: https://laracasts.com/series/server-management-with-forge/episodes/3

But what "magically" works for Jeff is not working for me. I need ideas, please!

EDIT 1: Was using 500-something MB account. Updated to 1 GB version of Forge and got same error. Working with DigitalOcean. Trying to follow this tutorial exactly (including the tools), and can't see what I'm doing wrong.

EDIT 2: It does have a fix listed for "Can't clone repository?" - but when I try to put the SSH key into github, it comes up with "Key already in use", even though no keys are posted in my settings.

0 likes
16 replies
clkline's avatar

I realize what the problem may be. This is our class project repository: https://github.com/FaithInMotion/capstone

/project is the actual application. It is set up this way so I could use github to push all vagrant files and such to 4 other students.

Is there a way to call a specific folder of a branch when setting up the repository? Or do I have to completely rework my repository to fit Forge's specifications?

EDIT: I thought to add a line after git pull origin production to cd project. This produces a new error, and I am not liking all of these "removals".

From github.com:FaithInMotion/capstone
 * branch            production -> FETCH_HEAD
Already up-to-date.
Loading composer repositories with package information
Installing dependencies from lock file
  - Removing phpunit/phpunit (4.8.7)
  - Removing phpunit/php-code-coverage (2.2.3)
  - Removing phpunit/php-file-iterator (1.4.1)
  - Removing phpunit/php-timer (1.0.7)
  - Removing phpunit/phpunit-mock-objects (2.3.7)
  - Removing phpunit/php-text-template (1.2.1)
  - Removing sebastian/environment (1.3.2)
  - Removing sebastian/global-state (1.0.0)
  - Removing sebastian/version (1.0.6)
  - Removing phpunit/php-token-stream (1.4.8)
  - Removing phpspec/phpspec (2.3.0)
  - Removing phpspec/php-diff (v1.0.2)
  - Removing phpspec/prophecy (v1.5.0)
  - Removing doctrine/instantiator (1.0.5)
  - Removing sebastian/comparator (1.2.0)
  - Removing sebastian/diff (1.3.0)
  - Removing sebastian/exporter (1.2.1)
  - Removing sebastian/recursion-context (1.0.1)
  - Removing symfony/yaml (v2.7.4)
  - Removing phpdocumentor/reflection-docblock (2.0.4)
  - Removing mockery/mockery (0.9.4)
  - Removing hamcrest/hamcrest-php (v1.2.2)
  - Removing fzaninotto/faker (v1.5.0)
Generating autoload files
> php artisan clear-compiled
> php artisan optimize
Generating optimized class loader


                                                                                         
  [PDOException]                                                                         
  SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)  
RomainLanz's avatar

You also need to configure your environment variable.

clkline's avatar

I am going to be working on this today - Jeff did not have to right away in the tutorial, so I was confused.

clkline's avatar

I can't set environment variables per the tutorial for doing so. All I have is a button to edit the .env file. I SSHed in and it looks like some of the repository didn't make it over, so I am trying again. I think gitignore is at fault this time.

RomainLanz's avatar

All I have is a button to edit the .env file.

You need to click on this button and then you'll have a popup to copy your environment variables.

clkline's avatar

I edited the file, and I am still getting this:

Generating optimized class loader


                                                                                         
  [PDOException]                                                                         
  SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) 

I do not think I am editing the file correctly, and the Laracasts that I am following are 1 and 2 years old, and really seem completely irrelevant now. Can you point me towards an updated tutorial on how to set up these variables correctly? This is my first Laravel site and I literally have no idea what I'm doing.

RomainLanz's avatar

So you have created a droplet with Laravel Forge and you have bind a GIT repository to a new site created with Laravel Forge?

Now, when you go to the top menu and select your site, you will have an "Environment" tabs and then a button "Edit environment".

Imgur

After clicking on it, you need to set your database settings. Normally, you have received an email with your database user (forge) and the password.

Imgur

clkline's avatar

Yes, I set those with the new information from the email, but the site doesn't seem to recognize it - when I try to redeploy, I get the same error.

Imgur

Imgur

RomainLanz's avatar

Did you have the same content if you ssh into your server and look at the .env file?

clkline's avatar

Oh interesting. Okay so this is going back to the issue being that the site itself is one level INTO the github repository (must cd into project to actually be in the site). So the new .env file is being generated one level higher than it needs to be, and my original .env file is staying in tact.

Ideas on how to fix this?

EDIT: I know I can move the environment file into the correct directory, but I feel like this is not the right answer.

RomainLanz's avatar

Can I see your deploy script?

This is mine:

cd /home/forge/yourSite
git pull origin production
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force
gulp --production
clkline's avatar
cd /home/forge/default
git pull origin production
cd project
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force

The cd into project fixed the original error of composer files not being found, and I am not sure if we are getting as far as the php artisan migrate - but we must be if we are getting a mysql error, right?

Also, if you try to peek at the site, you get: No input file specified.

I was going to wait to ask this but I feel like it's worth asking - is this because the server is looking at the top level still?

clkline's avatar

I'm not sure what "name" implies here. If it's folder name, then it is going to be "project". Otherwise, we don't really have a name right now, and it's most likely going to be the only one on this server. So I left it at default. It's the "site" that comes when you set up the server.

clkline's avatar

After a night of sleep, I finally thought to copy the .env file into /project. Now, when I "deploy", there are no errors. The database is migrating correctly. But I am still getting: No input file specified.

This is from both the ip address given to me, and the ip address/project.

Ideas?

Please or to participate in this conversation.