WordPress plugin isn't deployed to OpenShift - wordpress

After setting up WordPress site on OpenShift, I tried to upload new plugin from my local repo, according this manual, but nothing was uploaded to OpenShift.
Step I've done:
# cloning WordPress app from OpenShift
rhc git-clone -a wpdev
# Going to plugins folder on local machine
cd ~/openshift/wpdev/.openshift/plugins
# cloning my plugin from GitHub to openshift plugins folder
git clone https://github.com/samuelsh/youtube-channel-player.git
# standart add/commit/push
git add plugins
git commit -m "youtube-channel-player deploy to openshift"
git push
After checking my wpdev app on openshift, looks like my plugin isn't uploaded.
What could go wrong here?
Thanks

Well, appeared it was git submodule issues.
Trying explicitly add new files to repo resulted following error:
git add .openshift/plugins/youtube-channel-player/*
fatal: Pathspec '.openshift/plugins/youtube-channel-player/admin' is in submodule '.openshift/plugins/youtube-channel-player'
Removing the directory from git and adding it again worked for me:
git rm --cached directory
git add directory

Related

Moving the Git Repository to a Child Folder

I'm using Github with my Wordpress website.
Currently it tracks the parent Wordpress folder, which essentially tracks everything.
I'd like it instead to have a git with only the theme, which is located at wp-content/themes/lighthouse
Is there a simple way to have this repository only be the theme rather than everything in Wordpress? Without having to make a new repository?
If you really don't want to create a new repo, you would simply delete the other folders, and push that new (trimmed) commit back to your existing repo.
Note that you would conserve the other folders history in your past commits.
The techniques mentioned in "Detach (move) subdirectory into separate Git repository" would in effect create a new repo (one with an history only involving the folder you want to keep)
To move git repo to subfolder wp-content/themes/lighthouse while keeping the subfolder’s history, you can refer below steps:
git clone <repo URL>
cd reponame
# checkout all the remote branches locally by git checkout branchname
git filter-branch --subdirectory-filter wp-content/themes/lighthouse -- --all
git push -f --all
Now the git repo moves to the subfolder wp-content/themes/lighthouse and keeps the related histories

Create local git repository based on local repository based on github repository and keep it updated

I have some basic git knowledge but I'm not sure how to accomplish this.
I am trying to clone (?) github WordPress starter theme underscores. The idea is to create a basic framework based (with some modifications) on that repository. Then create other themes with that framework as the base.
So it should look something like:
copy github underscores repository to local
create a local repository my_framework from the underscores one, modifying certain parts of those files always (such as the name) and adding some other files
create new local repositories my_theme1, my_theme2 based on my_framework
The goal is to keep everything updated with any underscores update, while changing and modifying the framework and the themes. Once the content from github is pulled it should keep (or inform) of any updates, but I don't need any change I make locally to go back in the path.
I am not sure which path to follow, and would appreciate any help or pointer.
The goal is to keep everything updated with any underscores update, while changing and modifying the framework and the themes
That is called the triangular workflow:
fork (see "Fork a Repo") the repo automattic/_s
clone that fork locally,
git clone /url/my/fork myfork
add as remote upstream the original repo
cd myfork
git remote add upstream https://github.com/automattic/_s
From there, with git 2.9 or more, configure:
git config --global pull.rebase true
git config --global rebase.autoStash true
Finally, each time you want to update your branches (where you modify your own version of the original repo), do a
git checkout mybranch
git fetch upstream
git rebase upstream/master
Then you can merge that updated branch (after testing it) to your other repos my_theme1, my_theme2, cloned from myfork.
cd my_theme1
git fetch
git merge origin/mybranch
If you want to work locally only, you can skip the fork step and clone directly the original repo.
you should learn about child themes. the concept of it is having a main theme - which gets updated - and a child theme that'll you'll modify, add content, create different templates & styles... everything to your needs.
I'd recommend taking some minutes to read this throughtfully: https://codex.wordpress.org/Child_Themes
Assuming you using a terminal,
cd to the themes directory:
cd [PROJECT]/wp-content/themes
Now clone _s to your project:
git clone git#github.com:Automattic/_s.git [THENE-NAME]
After the clone ends you can start working with your new theme.
cd to theme directory:
cd [THENE-NAME]
and create another remote for your repo.
git remote add [NEW-RENOTE-NAME] [NEW-RENOTE-URL]
From now on, you can push change into your private remote:
git push [NEW-RENOTE-NAME] master
and if you want to get updates from _s repo you can just:
git pull origin master
Good Luck!
you could do something like
git clone https://github.com/Automattic/_s.git
create directory my_framework with mkdir my_framework(if on windows)
cd my_framework
git init
git remote add <_s> <PATH to your local underscore>
git pull(to get latest version of underscore)
again:
mkdir my_theme1
cd my_theme1
git init
git remote add <my_framework> <PATH to your local my_framework>
git pull
Hope this is what you are looking for!
What you want to do is called nested git repo. GitHub does not allow nested repositories. You can use GitSubmodule or subtree. It is done for when projects become bigger.
One copy of underscores will remain as "control".
Second copy of underscores will remain is starting of my_framework. Third copy is copied and modification of my_framework.
You can :
Update underscores repo aka WordPress starter theme underscore master separately
Change in your framework separately
Send pull request for wherever you want to contribute
my_theme1, my_theme2 are not versions but separate softwares. my_theme1 as example can have nth versions. Here are sample steps :
cd ~
mkdir parentrepo
cd parentrepo/
git init .
mkdir child1
mkdir child2
cd child1/
git init .
echo "FirstChildRepo content" > child1repofile.txt
git add .
git commit -a -m "Adding FirstChildRepo content"
cd ../child2/
echo "SecondChildRepo content" > child2file.txt
cd ..
echo "parentrepofile" > parentFile.txt
git add .
git commit -a -m "Adding Parent Repo content"
# verify whether working independently
cd ~/parentrepo/
git log
cd ~/parentrepo/Child1Repo/
git log
# try cloning parent, verify the contents
cd ~
git clone parentrepo/
cd parentrepo/
ls -a
./ ../ .git/ child1/ child2/ parentfile.txt
cd child1/
ls -a
./ ../
Work after this step to clone, update in the way whatever like others written.
You can "auto update" too. Add files named post-checkout & post-merge to .git/hooks directory of the needed repositories and add this into each of them:
#!/bin/sh
git submodule update --init --recursive

What causes a fatal: not a git repository error?

I am working on webpage, and I need version tracking, so I'm uploading it to github.
Here is the underlying set up.
https://developers.google.com/appengine/articles/wordpress
Now that I have the base CMS ready to go, I need to get the base code uploaded before I start making changes.
lloydm#lloydm-E6320:~/Downloads/rtt/rtt-code$ pwd
/home/lloydm/Downloads/rtt/rtt-code
lloydm#lloydm-E6320:~/Downloads/rtt/rtt-code$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# wordpress/
nothing added to commit but untracked files present (use "git add" to track)
lloydm#lloydm-E6320:~/Downloads/rtt/rtt-code$ ls
app.yaml cron.yaml php.ini wordpress
lloydm#lloydm-E6320:~/Downloads/rtt/rtt-code$ git add .
fatal: Not a git repository: wordpress/wp-content/plugins/../.git/modules/appengine-wordpress-plugin
I've never used github before, so I was just following the github website stuff. I have zero idea what this error means or how to prevent it. I can't find anything that I think is related to it.
You need to set up your git repo correctly.
I think you followed this section "Installing WordPress on your development environment" from the link you provided https://developers.google.com/appengine/articles/wordpress
So what you did was download WordPress into your folder which you set up to be a .git repository. However, the WordPress project builder you downloaded itself contains a .git repository.
Check if you have a /workpress/.git file. It likely contains something like :
gitdir: ../.git/modules/wordpress
If you do, then that explains the error I think.
As for setting it up correctly, there are many tutorials available.
One way is to use Git for theme deployment, rather than having it manage your entire WordPress installation --> http://culttt.com/2013/04/08/how-to-deploy-wordpress-themes-with-git/
Another way is to add wordpress as a submodule http://www.efeqdev.com/website-development/this-is-how-we-version-control-and-deploy-our-wordpress-websites-with-git/
or Just make a ~/Downloads/rtt/rtt-code/wordpress/myWebpage directory and set up a git repo in it. http://www.whistlenet.com/git-for-wordpress/
I think you just need to go into the wordpress folder and then run the git status command. As the directory(rtt-code) is not a git directory but contains within it the git repo, that is wordpress, you are getting this error.
Inside the wordpress folder, all your git commands would work perfectly well...

how to install roots theme and wordpress as git submodule

I am wordpress developer and want to use git in wordpress. I also want version control in my wordpress so that everything in the projects gets updated frequently.and also how to install wordpress as git submodule?
thanks,
suku
Just add wordpress as a submodule from the root directory of your project like this:
git submodule add git://github.com/WordPress/WordPress.git ./your/submodule/directory
Make sure that the directory doesn't exists before executing the above command.
I like to keep my root project directory nice and clean, and I use Wordpress Skeleton in a directory called "app," while Wordpress sits in a directory called "wp," therefore I execute the command below from the root project directory.
git submodule add git://github.com/WordPress/WordPress.git ./app/wp/
This makes it really easy to update wordpress and keep everything under version control. To update to 3.8.1 do the following:
cd wp
git fetch && git fetch --tags
git checkout 3.8.1
cd ./
git add wp
git commit -m “Updated to WP 3.8.1”
git push
I wrote an unfinished article about it over here: http://www.kj-prince.com/wordpress-development-deployment/
Hope this helps.

Keeping WordPress in version control - separate repo for theme

I have my WordPress project under Git and have WordPress as a submodule. I want to keep my theme development in a separate submodule, but within the current setup and am having some difficulties getting the theme setup as a submodule.
Here is my file system:
/.git (master repo)
/index.php
/wp-config.php
/wordpress (WordPress repo as a submodule)
/wp-content
themes
test-theme (theme repo)
.git
index.php
(etc...)
Now when I push my master repo to github, and try and clone it on another machine, the wordpress submodule downloads fine, but my theme folder does not, and I get an error about submodule not being defined.
I've tried using this to add my theme as a sub-module:
git submodule add ./wp-content/themes/test-theme/.git ./wp-content/themes/test-theme
but I get the following error: "remote (origin) does not have a url defined in .git/config"
How do I defined my theme repo as a submodule, when it is essentially hosted "inside" the project and not at a separate repository online?
Thanks.
I'm still relatively new to using submodules but I have been trying to do something similar and found two blog posts quite helpful: one by Clint Berry and another by David Winter.
The principle of a submodule is that it should have a separate repo and then when you add that submodule to a new project the add submodule command should be pointing to the repo:
git submodule add https://github.com/youruseraccount/test-theme.git ./wp-content/themes/test-theme
git init
git update
I believe this is why you are getting the error, there is no URL associated with the origin. Look in the files .gitmodule and .git/config to confirm. If I am correct, the git init will add the necessary entries in .git/config and git update this will pull the theme from the repo and put it into the subdirectory.
See here for how to commit changes to the submodule and here for how to remove the submodule.

Resources