I'm trying to learn more about git and how to manage my Drupal sites with git.
I've managed to create a repository, push it to GIT, and clone it on my remote server. However, I can't get the version on the remote server to work. I get this message every time
"Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request."
I've tried doing everything the same, except ftp'ing the files to the server and they work fine. I've check both the .htaccess file and the settings.php files - and they seem to be the same in both the functional and non-functional sites.
I've also tried cloning Drupal 7.x directly from drupal.org with git to the remote server and that doesn't work either.
Why won't my git cloned site work?
Or at least, where should I be looking for the problem?
- - - - 6/11/13 - - - - -
I've added details on my step by step process in the comments below:
https://drupal.org/node/2015769#comment-7521665
- - - - - 6/12/13 - - - - -
SOLUTION - See below: Turns out my problem was with permissions. For some reason, GIT assigned the files in my Drupal site different permissions than they originally had. I just needed to reset them to #755
Comments
.gitignore
Do you have a .gitignore file that is not creating settings.php on the second server?
.gitignore is there
Yes, I do.
I assumed that the problem must be either settings.php or .htaccess . I've been through both files and can't find anything wrong.
After uploading the same site via ftp and git to the remote server - I made sure they were also using the same .htaccess and settings.php files. And still, the site I moved with ftp was working but the site moved with git was not.
The .htaccess and
The .htaccess and settings.php should almost always be different between the two installations. settings.php will definitely be different (unless you are accessing a remote database), and .htaccess will usually be different. Get rid of your .htaccess in the installation that isn't working, and replace it with a fresh one from a Drupal installation, and it should solve your problem. Also, remove these files from your git repository, and add them to your .gitignore.
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
Tried that
I'll step back and clarify. I'm attempting to learn how to use Git - so my goal is really to move a site from my local development environment onto Github and then move it to a remote server.
I've tried this multiple times with the exact same site. When I ftp the site to the server I am able to access the site. When I use git to move the exact same site, it does not work. If the .htaccess and settings.php files works for one version of this site - I don't see why they wouldn't work for the other version of the site. It's the exact same site - only moved to the server in a different way.
The settings.php file is in my .gitignore file. I've tried running the fresh install without it and after manually installing. I've tried fresh files from a fresh Drupal install. I've looked at the settings in from a functional site and compared them with my git installed site - no luck.
Also, I've tried cloning a fresh install of Drupal with Git and it doesn't work. I'm beginning to think it must be something about the ISP or my set-up at the ISP. I'm using shared hosting.
If you are trying to migrate
If you are trying to migrate a site from your local to a remote server.
This is my preferred method for creating a new installation:
1) Download and install the Backup and Migrate module on your local system. Commit the files for this module to Git.
2) Clone your repository to your remote file system.
3) Install Drupal from scratch on your remote system using the file system you just cloned. Don't spend too much time thinking about the values you set, as they will all be overwritten in later steps. Just get through the installation. (Note - if settings.php is part of your git repository, you will need to remove it, and create a new one by copying default.settings.php).
4) After installation, enable the backup and migrate module on the remote system.
5) On the local installation use the backup and migrate module to create a backup. The default settings will be fine.
6) On the remote installation use the restore function to upload the backup from the last step.
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
Thanks
Jaypan - thanks much for taking the time to help. I think that is pretty much the process I'm trying to make work. The problem is that I can't get the git migrated files system to operate and go through the installation process.
If I FTP the exact same files, I'm able to run the installation process. But, when I use git to put them there - I just get error messages.
My next step, right now, is to go through the entire process again. This time documenting the steps in detail, that way someone might be able to spot my error.
As I've said, you need to not
As I've said, you need to not have the .htaccess and settings.php as part of your repository. If you are getting errors, you have one or both of these as part of your repository, which will cause errors. Remove them from your repository.
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
Thanks again
I've tried removing these files. I've tried replacing them with fresh files. I've tried comparing them to the files of working sites. I've removed them from the repository. (These were some of the first things I tried before posting here).
Here is what I did. Did I do something wrong?
I just ran through the entire process again. Here is what I did in detailed steps. Why does OPTION 1 fail while OPTION 2 works fine.
OPTION 1:
---------
1) Create Fresh Installation of Drupal in folder called "gold" (on local laptop)
2) Import site into Aquia Dev Desktop / create new database
3) Install Back-up and Migrate & Devel modules
Created some "devel" content
4) *** cd gold
5) *** git init
6) *** git status
7) *** git add -A
8) *** git commit -m "Initial Commit"
9) Create a repository on Github named "gold"
10) *** git remote add origin git@github.com:stpaultim/gold.git
11) *** git push -u origin master
12) Checked on Github and all files appear to be there
13) SSH into remote server
14) *** cd public_html
15) git clone git@github.com:stpaultim/gold.git gold
16) http://www.lexlake.com/gold
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator, webmaster@lexlake.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
NOTE: I tried removing .htaccess files and settings.php - does not help.
OPTION 2:
---------
1) Duplicate "gold" folder on local laptop new name = gold2
2) ftp to lexlake.com
3) http://www.lexlake.com/gold2
"Select an installation profile" appears and we're off and running.
What does your public_html
What does your public_html filesystem look like after you've cloned your git files? Are the file permissions correct?
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
Permissions
Is this what your asking about?
drwxr-xr-x 10 politalk politalk 4096 Jun 11 09:54 ./
drwxr-x--- 13 politalk nobody 4096 Jun 11 09:53 ../
-rw-rw-r-- 1 politalk politalk 6604 Jun 11 09:54 authorize.php
-rw-rw-r-- 1 politalk politalk 79216 Jun 11 09:54 CHANGELOG.txt
-rw-rw-r-- 1 politalk politalk 1481 Jun 11 09:54 COPYRIGHT.txt
-rw-rw-r-- 1 politalk politalk 720 Jun 11 09:54 cron.php
drwxrwxr-x 8 politalk politalk 4096 Jun 11 09:54 .git/
-rw-rw-r-- 1 politalk politalk 174 Jun 11 09:54 .gitignore
-rw-rw-r-- 1 politalk politalk 5603 Jun 11 09:54 .htaccess
drwxrwxr-x 4 politalk politalk 4096 Jun 11 09:54 includes/
-rw-rw-r-- 1 politalk politalk 529 Jun 11 09:54 index.php
-rw-rw-r-- 1 politalk politalk 1451 Jun 11 09:54 INSTALL.mysql.txt
-rw-rw-r-- 1 politalk politalk 1874 Jun 11 09:54 INSTALL.pgsql.txt
-rw-rw-r-- 1 politalk politalk 703 Jun 11 09:54 install.php
-rw-rw-r-- 1 politalk politalk 1298 Jun 11 09:54 INSTALL.sqlite.txt
-rw-rw-r-- 1 politalk politalk 17861 Jun 11 09:54 INSTALL.txt
-rw-rw-r-- 1 politalk politalk 18092 Jun 11 09:54 LICENSE.txt
-rw-rw-r-- 1 politalk politalk 8191 Jun 11 09:54 MAINTAINERS.txt
drwxrwxr-x 4 politalk politalk 4096 Jun 11 09:54 misc/
drwxrwxr-x 42 politalk politalk 4096 Jun 11 09:54 modules/
drwxrwxr-x 5 politalk politalk 4096 Jun 11 09:54 profiles/
-rw-rw-r-- 1 politalk politalk 5376 Jun 11 09:54 README.txt
-rw-rw-r-- 1 politalk politalk 1561 Jun 11 09:54 robots.txt
drwxrwxr-x 2 politalk politalk 4096 Jun 11 09:54 scripts/
drwxrwxr-x 5 politalk politalk 4096 Jun 11 10:09 sites/
drwxrwxr-x 7 politalk politalk 4096 Jun 11 09:54 themes/
-rw-rw-r-- 1 politalk politalk 19941 Jun 11 09:54 update.php
-rw-rw-r-- 1 politalk politalk 9642 Jun 11 09:54 UPGRADE.txt
-rw-rw-r-- 1 politalk politalk 2051 Jun 11 09:54 web.config
-rw-rw-r-- 1 politalk politalk 417 Jun 11 09:54 xmlrpc.php
I think I see it. Set the
I think I see it. Set the permissions on the containing folder to 755. Your setup has not given read permissions to the 'other' group to your folder.
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
That was it!
Jaypan - Thanks very much for your help.
In fact, it was a permissions problem. I was meeting earlier this evening with the local Drupal User Group and I raised this issue and they quickly came to the same conclusion .
I adjusted my permissions and the site works fine.
Thanks again.
Just ruling out
Just ruling out possibilities, but did you set up a virtual host on your remote server to point to your lexlake directory?
If you want to do a bit of back and forth via e-mail or IM to get this up and running I am more than willing to help out.
Here is how I usually roll with Drupal in a git repo...
Head to your application directory on your local machine.
At the root of that directory execute
git initto initialize the git repoCreate your .gitignore file with the following code
Once that is in place, execute
git add .Then, execute
git commit -m 'initial commit'Next set up your remote for github
git remote add origin git@github.com:stpaultim/gold.gitThen, execute
git push origin masterNext SSH into your remote box
Head to the directory where you want your application to exist
Execute
git initExecute
git remote add origin git@github.com:stpaultim/gold.gitExecute
git pull origin masterOnce the pull is completed, scp your settings.php file and the files directory into your application.
I realize I was repeating most of your steps, but I didn't want anything to get lost in translation.
The only other thing I have to do is create a vhost file for the particular domain (dev.lexlake.com for instance) and restart the httpd service and check to make sure the domain works. (If you want me to walk through this with you I can, it's easy once you do it a couple times)
I don't see anything wrong with your use of git, my guess is that you don't have a virtual host created yet.
Good luck!
Thanks Again
I tried again using your steps which are very similar, but not exactly the same. You used "git pull origin master" instead of "clone." I got the same bad results with your steps.
I don't have to set-up .gitignore because it's included in the Drupal Installation default files, except the "cache/" line.
I'm actually using shared hosting at http://www.arvixe.com/ . I set this up specifically to get shell access. At this stage, I'm just testing the process. Once I get this all figured out, I may invest in VPS hosting if it seems worth it. I have a support ticket in with arvixe.com to have them check and make sure my site is set up correctly.
I may get back to you on the email/IM option. Thanks.
Thanks all
As noted above, it turns out that the problem was with the permission on my Drupal files. Somehow, GIT changed the permissions to #775 and they needed to be #755
Actually 775 will usually
Actually 775 will usually work fine on most systems, unless they have specifically been configured to not allow that setup. Your problem was that your webroot did not have 'read' permissions, so the site could not be accessed.
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
chmod -R 755 /* - try this
chmod -R 755 (drupal directory)/* - try this