Search

I added the submodule from the root directory of the symphony installation. I added the submodule so when I ran update it would track. I don’t think I added it as a submodule of itself.

@czheng, as you can tell i’m a newbie at Git. Please let me know if I’m adding submodules incorrectly. Thanks so much for your patience and help.

OK. I think I got it.

@czheng, I think you are right that I created a submodule within a submodule. Instead of cloning a submodule and then adding a submodule, all I needed to do was just add the submodule.

What I did is that I removed my submodule, I first tried git rm --cached extensions/xmlimporter, but it wouldn’t let me remove and gave me an error message that I needed to use the rm recursively with a -r. So that tipped me off that I must have created a submodule within a submodule (like czheng mentioned above).

So I ran git rm -r --cached extensions/xmlimporter and it removed the xmlimporter submodule. Then I added a the xmlimporter extension back the right way, I made sure that I was in my root directory of my symphony site and ran the following command to add the xmlimporter extension as a submodule.

git submodule add git://github.com/rowan-lewis/xmlimporter.git extensions/xmlimporter

Then changed directory into my xmlimporter extension directory and checked out the unstable branch for XML Importer… cd extensions/xmlimporter and ran git checkout -b unstable

Then I ran git status to see what branch I was on, it said unstable. So then I needed to pull in my changes (pull the unstable branch)… NOTE: I’m still inside my xmlimporter directory and then I run…

git pull git://github.com/rowan-lewis/xmlimporter.git unstable

and it output the following…

From git://github.com/rowan-lewis/xmlimporter
 * branch            unstable   -> FETCH_HEAD
Updating aa707ea..737d1c1
Fast forward
 content/content.importers.php |    8 +----
 extension.driver.php          |    4 +-
 lib/class.xmlimporter.php     |   66 ++++++++++++++++++++++++++---------------
 3 files changed, 46 insertions(+), 32 deletions(-)
 mode change 100755 => 100644 content/content.importers.php
 mode change 100755 => 100644 extension.driver.php

Focusing on the Updating aa707ea..737d1c1, which tells me that I it was pulling the commit that I wanted from the unstable branch. That’s what I wanted.

Then I changed directory back to my site’s root directory…

cd ../../ and ran git init and then git add . and then git submodule update --init and then I ran a git commit -m "updated to xmlimporter to unstable branch" to note my changes.

That updated my code.

Thanks for documenting!

@czheng - Thanks for helping me. I’m glad to document when I can… I know how much I benefitted from others who have done the same.

For future reference:

When you add a submodule.

git submodule add git://github.com/rowan-lewis/xmlimporter.git extensions/xmlimporter

git submodule init will register it with git. git submodule update will pull in the files for that submodule. When you push this commit from development to say live (git will show that the .gitmodules file has changed, and a new folder has been created), it stores the HEAD location of the submodule so when you pull on live and run a git submodule update it will know what HEAD to checkout for each of the submodules.

This is why from time to time you will get some nice fat errors if you swap to another branch, or fork during development and mistakenly commit those changes. Upon pulling on live, it will look for HEAD location that doesn’t exist.

One way around this is to set up different remotes inside the submodule and use those to push. ie.

cd extensions/xmlimporter
git remote add github git@github.com/brendo/xmlimporter.git

Now if I do any changes to the XML Importer I push them to my fork and request a pull from Rowan. To ensure I don’t get errors, I submit a pull request and wait for him to update his branch before committing.

Sometimes when the repo owner is slow to react, you can just change where .git thinks the module is kept. To do this, edit .gitmodules and .git/config from the root of your project and modify the remote location. You will also have to cd extensions/xmlimporter and edit the .git/config in there to update the remote location.

Now to get where bzerangue wants to go. If Rowan pulls my changes for XML Importer most often he’ll put them in an unstable branch so they can be tested before pushed to the masses. To checkout the unstable branch you have to do a little bit more.

cd extensions/xmlimporter
git checkout -b unstable
git pull origin unstable

There you go.

From what I remember, .git is happy to work with branches between development and live, it’s forks that make it angry :)

EDIT: Doh, totally didn’t see there was a page 2!

nice write up stephen. i googled “git push ssh media temple dv” and this the fourth link on the results…even though I had already seen this thread haha. still trying to fully wrap my head around the whole git workflow and command line…which I am beginning to favor more than a gui.

one issue i’m running into though. after setting up the remote and local repos, i go through the clone process and am getting this:

Initialized empty Git repository in /path/to/domain/v2.0.8/symphony-2/.git/

and so instead of all my files being dumped into the v2.0.8 folder, i just have an empty symphony-2 folder in my v2.0.8 folder. what am i missing here?

edit:
after some more digging, i THINK i found that anything ending with a .git is just the pointers to the files of the repo, not the actual files themselves and hence the empty folder.

Can I ask without sounding too dumb. For the private directory on my server, do I need this to be in the same place as to where my Symphony install will be?

@NickToye, your git directory can live anywhere you want it to live. you can even make it live in a non-web accessible directory as long as you use the correct pathing to git it har har

@wdtan - Ok then I must be missing the point a little then. If I add it to a different directory to where my Symphony installation is, how can I update it?

I just don’t understand what to do here.

I tried to follow the installation instructions of installing Symphony through git, but I get this error:

fatal: Not a git repository
/usr/bin/git-submodule: line 1: cd: .git: No such file or directory
Unable to determine absolute path of git directory

When I am trying to run this code:

git submodule init

My Symphony is in domains/nicktoye.co.uk/html - and I am in that directory. What am I doing wrong here?

have you installed symphony using git?

No, I have installed Symphony the old fashioned way ages ago - but because of this bug thing that has occurred (see - http://getsymphony.com/discuss/thread/47968/) I have to update the workspace using Git.

Hmm, the git submodule function will update the submodules listed in the current repo.

Because you’ve not installed symphony using git, symphony is not a repo, so you can not update the submodules that easily.

You could clone symphony in an empty directory, and overwrite your symphony files with it. (nothing will change). If you move all the files, your installation will become a repo, and you could use the submodule functions.

But then how do I update my Symphony installation if I am installing into a different directory?

overwrite your symphony files with it.

Just copy the contents of the cloned folder over your installation.

but I don’t want to completely overwrite my workspace folder.

but I don’t want to completely overwrite my workspace folder.

Copy everything except for the workspace directory.

The Symphony Git repo doesn’t even include the workspace anyway. It’s a non-issue.

Really annoyed with this.

Frustration is natural, but voicing it this way probably isn’t going to endear you to the people who are going out of their way to help :)

I’m not annoyed with people, just annoyed that I can’t work it out.

I appreciate all the help.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details