I'm trying to push some Sphinx-generated docs to Github pages. I've found out that Jekyll removes the folders with an underscore; since I wasn't using it anyway I added a .nojekyll file to the folder, committed and pushed. However, nothing is happening yet. Did I do something wrong, does the process normally take some time, or should I force the page to rebuild in some other way? Thanks.
The problem was solved after another commit and push of a seemingly unrelated change. It was probably just Github pages not rebuilding the site and once a build was forced it was all fixed. Issue closed for me.
I had the same error and I found the issue on github pages repo: https://github.com/tschaub/gh-pages/issues/315
Answer: just add the parameter -t true ...
Example:
// Package.json
"deploy": "touch ./output_folder/.nojekyll && gh-pages -d output_folder -t true"
Related
Unfortunately, my computer crashed and I lost some lines of code that I typed. I committed my changes through Git before it crashed, so my repository has all of the code I lost. (I'm not sure how I didn't save before committing, but definitely something to look out for in the future...) My question is: How do I go about restoring my old file from Github to my Desktop through Git?
I hope I understood correctly, all you need to do is simply run 'git pull' on your terminal (if you are in the root directory of the project) and that's it. Hope it helps :)
You should check the logs using git log.
Finding the commit you need and the using a git reset.
Here is some documentation if you need it: https://www.git-scm.com/docs/git-reset
I'm trying to follow the tutorial instructions here : https://rtyley.github.io/bfg-repo-cleaner/
I clone a new copy of my github based repo with --mirror
I follow the instructions for running bgf and reflog
My local repository has now removed the big blog. Great.
When I go to push back to github I get
To github.com:interstar/myproject.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git#github.com:interstar/myproject.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
So I try to git pull from github to ensure sync. (Even though this repository was cloned cleanly from github at the start of the process)
And it pulls down all the blobs I want to get rid of. So my repo is back up to its previous size.
So I run bfg and reflog again. Nice small repo.
Try to push back to github
Same error message.
What am I missing?
OK.
I solved this. It was my own stupid fault, but leaving the question in case anyone else does the same thing.
Although the first time I cloned the repo from github I used --mirror, at some point I tried again and forgot to use the --mirror option.
When I started over with that option it worked as the tutorial suggested.
A quick question of people on StackOverflow.
I am trying to push to GitHub but I made a mistake where I added all of the wrong files to my GitHub page.
This leads me to not push my code on the terminal and I also cannot push my code onto a website used by Namecheap.
Does anyone have solutions/recommendations towards how they can fix the problem and make sure the terminal command is clear of untracked files?
Below screenshots contain the errors.
I see 2 problems.
1) Looks like you cloned your repo in home directory. Due to this git is seeing all files unrelated to your project.
2) I guess you did not want to commit files under todolist and tried to delete them.
I can suggest below solution.
a) Create a directory like ~/project/code/git and clone your repo again to that path.
b) Merge all required changes from previous path into newly cloned repo.
As you don't want to push todolist to github, you can move it to ~/project/docs/todolist.
Alternately, you could use .gitignore to "tell" git to ignore todolist folder, but I would recommend docs folder option.
Hope this will solve your issue.
There is a git repo in your home directory. Try this:
Remove .git folder in your home directory which cause the problem
rm -rf ~/.git
Clone your repo into another directory
Copy and overwrite all of your modified files
Push your changes
I have a C# MVC .Net Core application I'm building, the connection string is in a file called appsettings.json so what I want to do is simply exclude this from my git repository. I have added the following line to the git ignore file:
appsettings.json
I have also tried:
**/appsettings.json
But neither seem to work, the change I've made to the appsettings.json file still appears, am I missing something fundamental here?
This is a common misunderstanding about the way .gitignore works we all met at some point when working with Git: .gitignore will ignore all files that are not being tracked yet; indeed, files that are already being tracked in your Git repository are not ignored by your .gitignore setup.
To fulfil your need, it would be sufficient to untrack the files that you desire to ignore, i.e. in your case the appsettings.json file.
As reported in your question's comments, this has been answered already here. Then, your .gitignore setup will work as you would expect.
Adding an entry to your .gitignore file won't remove any files that have already been added to your repository. You need to remove them manually. For this you can use the rm command:
git rm --cached project/appsettings.json
Every answer in this thread misses the point: Being able to ignore changes on a tracked file.
You do not want to completely untrack this file as this would make you send the deletion of the item on the remote next time you push and thus delete the file for every of your collaborators, which you obviously do not want.
What you're looking for is actually perfectly possible in git, while a bit hidden:
git update-index --assume-unchanged <file>
which will precisely ignore the changes on a tracked file.
Now you can modify your appsettings.json file all you want and git won't bother you with it, and won't upload the changes when you push to the remote.
This is the official reference of git look at here
it says:
The purpose of gitignore files is to ensure that certain files not
tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
git rm --cached
I am using the gem "jekyll-assets" on my site and it fails when pushing to github pages. I have read that a way around this is to build the site locally, which builds just fine, and then push it to github pages. The examples of people doing this, however, are using a project repository and they are pushing the site to a "gh-pages" branch. I am doing this site for myself and the setup for this suggests using the master branch under the repo .github.io. How do I push a local jekyl build to a site with this setup?
You need to push only the content of the _site folder. Nothing else, nor the folder itself.
If you are setting up a project site, push the content to the gh-pages branch. If it's your user website, the repo must be named username.github.io and your site root needs to be the master branch.
Let me know how it goes! :)
Hope to have helped!
Here a windows batch file that pushes generated files back to github. Name it site_publish.bat and put it into the root of your project.
#echo off
cd /d "%~dp0"
rmdir _site /s /q
call jekyll build
git --git-dir=.git --work-tree=_site add --all
git --git-dir=.git --work-tree=_site commit -m "autogen: update site"
git --git-dir=.git --work-tree=_site push
You may want to try jgd command line, which automates all the steps suggested by other answers, in one simple call:
$ jgd
The site will be packaged and then deployed to the gh-pages branch of your repo, provided you have all permissions configured. More about it in this blog post of mine: Deploy Jekyll to GitHub Pages