wp submodule update to 4.7.2 - Unable to checkout - wordpress

I am trying to update my wp submodule to 4.7.2 (I use capistrano to deploy).
I am able to update locally but when I deploy to staging or production I get the following error:
git stdout: Nothing written
git stderr: From github.com:WordPress/WordPress
9bf3844..d333018 master -> origin/master
fatal: reference is not a tree: 1ea8e9a4f03f425a6a77c3487528fedd3f33c100
Unable to checkout '1ea8e9a4f03f425a6a77c3487528fedd3f33c100' in submodule path 'wordpress/wp'
But that tree must exist for it to be working locally right?
Any ideas of what direction I should be looking in? Or better yet a solution!
Thanks
N

I needed to delete my repo from the server and then redeploy. Seemed to have an issue with the submodule in the Capistrano routine.
THanks

Related

Creating a git repo for an existing R project - "fatal: Couldn't find remote ref master" error

I want to finally start using version control for my R projects. I started following this guide, created an empty repo, but the problem started when I got to the command line part.
First I did:
git remote add origin https://github.com/username/repo_name.git
But after I type:
git pull origin master
I get this error:
fatal: Couldn't find remote ref master
Now, if I try the following:
git remote -v
I get:
origin https://github.com/username/repo_name.git (fetch)
origin https://github.com/username/repo_name.git (push)
So something is working. I am new to git and not sure about where the problem is.
As an attempt to fix the problem, I added one file for the repository (file.R) but apart from that, the repository is empty. I get the same error as before.
And if I try git branch -r on the terminal I don't get anything in return.
If you started by creating an empty repo in GitHub, then the default branch is no longer master. The default branch is now main.
If you started by creating a new repo locally using git init, then check what your default branch is using git branch. This should show you either a main or master branch.
It may be easier to create the repo in GitHub with a simple README.md and .gitignore, then clone that repo to another folder. Move your code into that repo, add and commit everything, then push your code to GitHub.

Capistrano deploy hangs at check_changes step

It hangs on the check_changes step at this command:
Command: cd /home/myproject/repo && git diff --name-only HEAD
With this output in terminal:
DEBUG [c3f0a05b] content/plugins/akismet/views/notice.php[m
DEBUG [c3f0a05b] :[K
A couple notes which may make this case unusual:
This is deploying a WordPress site.
WordPress core and plugins were (mistakenly) updated on the server using wp-cli so that production code and repository would be unsynced.
Solution turned out to be simple. But it required a lot of useless googling before I finally figured it out by trial-and-error. Posting this as a reference for others who may find themselves in this situation.
The fix was to ssh into the server and remove the repo directory from the project root:
cd /home/myproject
mv -v repo /tmp/cap-repo
After this, I was able to run the cap deploy command successfully.
I would be interested in hearing an explanation for the [m and :[K output.

Git push failure (Github/RStudio)

I've used Git successfully on this machine in the past but suddenly I can no longer push my commits to the Github repo. The last change to the Git toolchain that I made was to install Git 1.8.5.2, in addition to the Github for Windows client. RStudio could not find Git unless I'd already started the Github client so I decided to simply install a stand-alone Git client and change the RStudio Git path.
Error message (RStudio):
error: cannot spawn rpostback-askpass: No such file or directory
fatal: could not read Username for 'https://github.com': No such file or directory
Troubleshooting:
I can commit all projects.
I can pull new projects.
I cannot push any projects, I receive the same error message every time.
I cannot push with Github or RStudio.
Reinstalling /uninstalling Git / Github does not resolve the issue.
Setup:
This is an R project, with RStudio as my IDE / Git GUI.
I'm using Git 1.8.5.2 for Windows 7.
Let me know if there's any more information that you need.
Update 1:
Git GUI tells me that:
Error: hook execution requires sh (not in PATH).
Let's see if I can fix that...
Found something that might help from here: https://github.com/STAT545-UBC/Discussion/issues/93
in RStudio, click on the "Tools" menu and select "Shell"
Run the following command: git push -u origin master
it might ask you for your git username and password. Supply this information, make sure it is correct
hopefully the push is successful, then you can close the window
Now make some more edits to some file so that you have new content to push
click on the "push" button in RStudio and this time the push should work
Found a different suggested solution here: https://github.com/OHI-Science/ohicore/issues/104
git config --global credential.helper osxkeychain

How to Upgrade and Deploy WordPress Install as a Git Submodule?

I am using a WordPress directory struture similar to Mark Jaquith's WordPress Skeleton, which has WordPress in a separate directory from the content as a submodule:
/content
/wp
/local-config.php
/wp-config.php
/index.php
I also use git and post-receive hooks to push my code changes up to my live server. It all works great except for when I try to upgrade WordPress and push that up to the live server.
This is how I setup the repo on my local machine and the remote server:
Local Machine
cd /www
git init .
git submodule add git://github.com/WordPress/WordPress.git wp
git commit -m "Add Wordpress submodule."
cd wp
git checkout 3.5
After checking out the tag, I get a warning from git about being in a 'detached HEAD' state. Since I don't plan on making any commits to WordPress, I don't think that should be an issue.
cd ..
git commit -am "Checkout Wordpress 3.5"
Remote Server
git init --bare
cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/home/public git checkout -f
chmod +x hooks/post-receive
git remote add web ssh://user#server/home/private/code/wordpress.git
git push web +master:refs/heads/master
I get this error:
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'ssh://userserver/home/private/code/wordpress.git'
After some googling, it looks like I can use this command to sync up the master branch up to the server (I have no idea how this works)
git push web +master:refs/heads/master
This doesn't help me though because I don't want to track master, I want to track a release tag, 3.5. Some more googling got me to this command:
git push web +3.5~0:refs/heads/master
To upgrade the submodule, I do this:
cd wp
git fetch && git fetch --tags
git checkout 3.5.1
git push web +3.5.1~0:refs/heads/master
Am I doing this correctly? All the tutorials I see for this just have git push web and they're done. Most don't even cover upgrading the submodule. This does work but I don't feel comfortable using this weird push syntax if I don't have to.
How do I push this detached HEAD state up to the server correctly?
I've also tried this using a branch with git checkout -b mywp 3.5 but when it comes time to upgrade, I don't know how to bring in the new 3.5.1 tag into my mywp branch.
Asked this on WP Answers, but it might be more appropriate here.
On the remote server try:
git submodule update --init --recursive
This will update all your submodules recursively
You can also issue:
git fetch --tags
This will update your local tags fetching updated list from the central remote repo.

Not a git repository error when updating via Composer

I'm trying to update my Symfony 2 project from 2.1.4 to 2.1.7 using composer and run php composer.phar update as normal, after updating a few dependencies I receive the following error:
[RuntimeException]
Failed to clone http://github.com/fabpot/Twig-extensions via git, https
and http protocols, aborting.
- git://github.com/fabpot/Twig-extensions
fatal: Not a git repository (or any of the parent directories): .git
- https://github.com/fabpot/Twig-extensions
fatal: Not a git repository (or any of the parent directories): .git
- http://github.com/fabpot/Twig-extensions
fatal: Not a git repository (or any of the parent directories): .git
I've checked the URL and can confirm that it exists, I'm also able to git clone it without any issues from the same CLI.
What's odd is if I run php composer.phar update twig/extensions separately it seems to update without a problem.
This typically happens if you have an old symfony copy that shipped with the vendors installed as git repos but with the git repos removed. To fix it you should just remove the vendor directory so they will reinstall from scratch as git clones or as zip archives, but without any previous assumptions.
Note that currently, I experience a similar issue while using composer with hhvm and PHP 7.
[RuntimeException]
Failed to execute git checkout 'hash' -- && git reset --hard 'hash' --
fatal: Not a git repository (or any of the parent directories): .git
The error appears depending on the composer.json not always but rather regularly. I switch off hhvm to get it working.

Resources