-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git Force-Push Deploy Pushes Root Instead of Build Dir #114
Comments
Same happening here.
|
I came here to report this very issue. I've been using middleman-deploy for years without issue, yet this recently started pushing up the entire project rather than just the build folder. |
same problem here. it does push all project, not build folder. (2.0.0 alpha) |
In case you need temporary quick fix,
YMMV though |
Hmm, this appears to be a git issue. I tried locking all old versions of middleman and it's nothing there. |
Guys, I forked jekyll-github-deploy into https://github.com/hovancik/middleman-github-deploy, you might wanna check it out. For now it solved problem with middleman-deploy. It's a bit different approach, but you can easy deploy your site to GithubPages with it. Works for me. |
I fixed this issue, by removing build directory before each deploy. For this purposes I use small extension #lib/build_cleaner.rb
class BuildCleaner < Middleman::Extension
def initialize(app, options_hash={}, &block)
super
FileUtils.rm_rf app.config[:build_dir]
end
end
::Middleman::Extensions.register(:build_cleaner, BuildCleaner) #config.rb
require_relative "./lib/build_cleaner"
configure :build do
activate :build_cleaner
end |
@robinbortlik I've found that your solution of deleting the build directory also is working for me. Where did you put this require in your config? I'm not sure when or why this started happening as everything was working fine for me about a week ago and I haven't changed anything that I know of since then. |
@robinbortlik 's fix worked for me. Any chance we can get this behavior as a default in middleman-deploy? |
@christopherjanzen @JustinHardage I'm glad that it helped. I put my require at the top of |
Also stumbled into this, thought I was going mad initially, so thanks for posting! |
Deleting build directory before each deploy made this work for me. Not sure what needs to be done to get this fixed. |
I've done some tests and that's my experience. I hope it could help. In root project
After the first
That's ok. But calling again
Build remove all git files, but not the .git directory.
So .git data of build directory will be removed, origin of root project will be overwritten, and the root project will be pushed instead of builded one.
That's why removing each time the In my opinion the build process should preserve the .git directory. Or the method above should do a more complex check process to see if remotes are ok.. |
However this implementation of Middleman::Deploy::Strategies::Git::ForcePush::add_remote_url will regenerate def add_remote_url
url = get_remote_url
`git init`
`git remote add origin #{url}`
`git config user.name "#{user_name}"`
`git config user.email "#{user_email}"`
end |
Borrowing a hotfix extension from this discussion: karlfreeman/middleman-deploy#114 The problem: for somereason mm-deploy starts deploying the source files to gh-pages isntead of the built output. This extension forcibly removes the build dir every time, which seems to solve the problem.
The issue isn't with middleman-deploy or git so much as it is with middleman v4 which changed the build process. v4.1.0.rc.2 includes a config directive to change this behavior and resolve the above problem. See middleman/middleman#1716 for the full details. I don't use middleman-deploy and still had this issue, for what it's worth (I've been using https://github.com/edgecase/middleman-gh-pages successfully for a long while). configure :deploy do
set :skip_build_clean do |path|
path =~ /\.git/
end
end |
Experiencing the same behavior with my Middleman 4 project. |
I used @egardner patch and it worked! Thanks! |
@coreyward 's information solved my Middeman v4.1 project's issue. Thank you! |
I'm trying to push my middleman
build
directory to a GitHub Organization Page. This means that my GitHub repomaster
branch needs to get the output of abundle exec middleman build
command.However, I haven't found any combination of options with
deploy.method = :git
that actually does this. I always get the root of the project - e.g. where the Gemfile lives - instead of something that GitHub Pages would recognize as a site with anindex.html
file.How can I deploy to a GitHub Pages site?
The text was updated successfully, but these errors were encountered: