1
votes

Just today I've been trying to get things up and running for a Silverstripe project. It's my first web project and I'm enjoying the ease of setup. I have it up and running with Apache on an Amazon EC2 instance.

I also have things set up locally using MAMP. The problem comes when I want to use git to track changes. I initialized git on the server and then cloned that repo to my local machine in the

/MAMP/htdocs

folder.

Here are the files that I'm tracking mentioned in this post about a version control and deployment workflow:

mysite
themes (with any sub folders)
.gitignore
composer.json
composer.lock

The problem is when I connect to my local host I get the Silverstripe default site with none of the changes that I've done on the EC2 instance. However, the links on the local host go to the EC2 Instance.

How do I configure git and Silverstripe to be able to push and pull easily to my remote server from my local machine so that the changes appear on my local machine?

I'm sure I'm overlooking something that is super easy and obvious. I just don't know what it is. Thanks in advance for your help.

UPDATE

I still don't have a solution but I think that I'm closer. I discovered that the Silverstripe directory

/themes/simple

already contained a git repo when being setup. In an attempt to make it work I removed the .git directory in that sub folder and tried to set up the repo again. Now I'm able to pull the resources that were missing but evidently they are still being mapped to the wrong place. I get the following message when inspecting the page in my browser and I still don't know how to solve this issue:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the 
remote resource at http://ec2-XX-XXX-XX-XXX.us-west-2.compute.amazonaws.com
/themes/simple/webfonts/Cambo-Regular-webfont.ttf. This can be fixed by
moving the resource to the same domain or enabling CORS.

I can verify that these resources now live in my local directory. How can I make silverstripe look for the resource on my machine. Is there a way to set up some kind of relative path? Should I even be using git with this at all? Haha

1
How is the webfont included? Did you look in themes for an absolute path to your ec2 instance? Did you try to make that path relative? - wmk

1 Answers

0
votes

I may be missing something obvious also, but since you cloned the repository you should be able to do:

git pull

which will update your local repository with the latest changes to the remote server. You can update the remote server with your local changes with

git push

Is that what you mean? If that doesn't help, does your .git/config contain a line with [remote "origin"]