I have question when creating blog with github - github

When I run
hexo d
in Git Bash
It jumped out :
fatal: repository 'https://github.com/rippleQAQ/rippleQAQ.github.io.git/' not found
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (C:\Users\HCC\Desktop\blog\myblog\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:513:28)
at cp.emit (C:\Users\HCC\Desktop\blog\myblog\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
rippleQAQ is my github name,and I've created a repository named rippleQAQ.github.io and SSH key
my _config.yml is:
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: https://github.com/rippleQAQ/rippleQAQ.github.io.git
branch: master
I need some help.Thank you.
I tried delete and recreate my github repository again and again.And change _config.yml.But it was no use.

As described in Hexo: GitHub Pages, if you go the Project page route (as opposed to GitHub Action), you would need to:
Navigate to your repo on GitHub. Go to the Settings tab. Change the Repository name so your blog is available at username.github.io/repository, repository can be any name, like blog or hexo.
Edit your _config.yml, change the url: value to https://username.github.io/repository.
Commit and push to the default branch.
Once the deployment is finished, the generated pages can be found in the gh-pages branch of your repository.
In your GitHub repo’s setting, navigate to Settings > Pages > Source. Change the branch to gh-pages and save.
Check the webpage at username.github.io/repository.
Meaning: you need to manually add, commit and push your code, to the main branch (not master, since oct. 2020)
And your _config.yml should use the gh-pages branch.
deploy:
type: git
repo: https://github.com/<username>/<project>
# example, https://github.com/hexojs/hexojs.github.io
branch: gh-pages

Related

Adding github pages to all subfolders?

I have a repository in github which will house all of my web development assignments in separate sub-folders like :
VishnuVelukutty/ CourseraWebdevAssignment (master)/ module2-assignment (subfolder)
So the master branch has gh-pages and I want to add the gh-page to all sub-folders (Assignment1,2,3 .....) independently so that they work independently when the specific module-link is opened
Is it possible to apply gh-pages to a subfolder ? or do I have create independent repo for each module ?
I have not initiated .gitignore, static site, readme nor theme and reffered to this post by cobyism and chrisjacob but i didn't get it working
Here is my github account to see if there any errors in setting up
For reference of the images here is the git link
First, make sure to create a gh-pages branch, add at least one commit in it and push it to your GitHub repository.
Then, yes, you can add that gh-pages branch content as a subfolder of your current repository, in the master branch, using git submodule.
(unless, as explained here, you chose the master branch itself as source for GitHub Pages)
git checkout master
git submodule add -b gh-pages -- /remote/url/of/your/own/repo gh-pages
git commit -m "Add gh-pages branch as submodule"
git push
You will have a gh-pages subfolder, that you can update at any time with:
git submodule update --remote

Deployment on github of a hexo blog

I created a repository on github and I would like to publish a blog created with hexo.
The html address of my repository is:
https://github.com/<my account name>/<my blog name>
The html address of my blog is:
https://<my account name>.github.io/<my blog name>/
I am using the plugin hexo-deployer git. I configure _config.yml like this:
deploy:
type: git
repos: git#github.com:<my account name>/<my account name>.github.io/<my blog name>.git
branch: master
message: "{{ now('YYYY-MM-DD HH:mm:ss') }}"
But that doesn't work !
INFO Deploying: git
You have to configure the deployment settings in _config.yml first!
What is wrong in my syntax ?
Thank you by advance,
If not answering late ...
Most of the articles on the internet on this topic (deploying a Hexo blog) suggest deploying with hexo-deployer plugin, either to master branch, or gh-pages branch.
But, with GitHub Pages there is a much simpler way, that doesn't require hexo-deployer plugin, and not even having other Git branches (other than master branch).
In your blog-level _config.yml file, set the public_dir: docs. This means that when you generate your blog content, it will be placed in the docs folder (on the master branch). Simply push the code to GitHub.
Now, you need to tell GitHub Pages server where your blog content to read from. In the GitHub repository, go to the Settings tab, and scroll down to the GitHub Pages section. As the Source, select the option: master branch /docs folder
You can find a more thorough explanation on this process here

index.html in github repo not opening

I am trying to see a static html file. My github url is anuragasaurus.github.io and my repo name is js-playground, it contains a index.html file.
I am trying to open anuragasaurus.github.io/js-playground/index.html but it's showing 404.
Can anybody tell me how can I access index.html file in my js-playground repo.
In order to view your project files as static webpage, you should store your files not in default master branch but in gh-pages branch.
You can create this branch using multiple methods but in order to find out the convenient one, you can use this GitHub Pages link.
Basically, let's assume that you already have master branch. If you are using git command line tool, you can do that with these steps:
cd your-project-folder
git checkout -b gh-pages (it will create new branch and switch to it)
git push origin gh-pages (it will create new branch on GitHub repo and push the existing files to it)

Is there a way to use a pre/post commit hook in github to update gh-pages branch from master?

I have a completely static site (eg. https://github.com/robertjchristian/angular-enterprise-seed) hosted on github, where I work mostly out of the master branch. The contents of the /app/ directory are byte-for-byte what I want to host. So during development I just cd ~/projects/angular-enterprise-seed/app, and then "python -m SimpleHTTPServer". This allows me to browse the site locally at localhost:8000.
I want to host the static contents of /app on the web as well, and gh-pages is the ideal candidate. Here are my requirements:
Don't want to "just use gh-pages branch as master"
Don't want to rely on a wrapper script that keeps gh-pages in line with master changes from the client.
Don't want to build out a service to handle the webhook post, checkout from master, and check into gh-pages.
Ideally it would be a github hook that says "Post commit hook - sync gh-pages with change in master"
Any ideas?
Thanks.
After reading through a variety of different solutions for handling the sync between master and gh-pages, I ended up adopting an approached favored by JavaScript guru Sindre Sorhus and others:
Make the gh-pages branch the default one on GitHub
Delete the master branch
Use the gh-pages branch as master.
You can see this on GitHub in Sindre's screenful.js repo, or in my project, selection-menu.

Fork from a branch in github

Is there a way to fork from a specific branch on GitHub? … For example, moodle has many branches (1.9, 2.0 … and so on). Can a clone be performed of just branch 1.9 and not the master branch always? Is it possible to clone a specific branch onto my PC?
I don’t know a native way yet, but you can do it following this recipe:
Fork the repository in question (called ‘upstream’) on the GitHub website to your workspace there.
Run the GitHub desktop application and clone the repository onto your PC.
Use the GitHub desktop application to open a shell in the repository. (The git commands are not available from the default PowerShell unless you configure that manually.)
Set the source repository as upstream:
git remote add upstream https://github.com/{user}/{source-repo}.git
Fetch the full upstream repository. (Right now, you only have a copy of its master branch.)
git fetch upstream
Make your file system copy the branch you want and give it any name:
git checkout upstream/{branch-in-question}
git checkout -b temporary
Publish your repo using the GitHub desktop application.
On the GitHub website, open your repository and click ‘settings’.
Change the “Default branch” to ‘temporary’. (Just change the drop-down menu, you don’t need to click the “Rename” button.)
Go back to your repository, go to the ‘branches’ tab, now you can delete the “master” branch.
Delete the master branch on your shell and make a new master branch:
git branch -d master
git branch master
git checkout master
git -d temporary
Once more, publish your repo using the GitHub desktop application.
On the GitHub website, open your repository and click ‘settings’.
Change the “Default branch” back to the (new) ‘master’ branch.
Go back to your repository, go to the ‘branches’ tab, now you can delete the “temporary” branch.
This should be what you were looking for. Perhaps GitHub will provide a more convenient way to do this in future (e.g., clicking “Fork” from a project’s branch results in exactly this behaviour).
Cloning means that you create a copy of the whole repository in your account including all branches and tags. However you are free to switch and track branches however you like.
No command line needed. Just create a new branch in your forked repository in GitHub. GitHub will ask you if you want to clone/mirror this new branch from the upstream repository. You can give any name to the new branch.
Yes, you can clone the single branch. For example, you have a branch named release1.0. If you would like to clone this branch into your pc then use the following line of code:
$ git clone git#bitbucket.org:git_username/git_repository_example -b release1.0 --single-branch
For those who don't like working with command-line. Here is a simple guide using the desktop client for GitHub:
Click the fork button of the repo on GitHub.com:
Make sure you have the desktop client installed
Click this button:
Clone the repo
In the desktop client, select the desired branch
Select the branch you'd like to work on and you're done
I'm posting here the method I've used.
Like the OP I wanted to only copy/fork one branch. But couldn't find an easy way.
in your repo create a new branch. It doesn't need to have the same name as the branch you want to fork
once created, verify that it is the selected branch, and click "Compare"
reverse the order of comparison (I have a userscript for that, see my profile if it's something you want to test).
the "base" repository must be yours, with the branch you've created
the "head" repository is the original, and the branch is the branch you want to fork
hit "create pull request" and continue until the PR is applied
That's it. You have the branch forked.
I'm using bitbucket but I'm sure this would work for GitHub as well.
Create a new repository
Checkout the branch using GitExtensions
Click Push to open the Push dialog
Set the destination URL to the new repository
Set the destination branch to "master"
Push
Your new repository will have the full history of the one branch only (not all branches like forking will have).
A fast, alternative approach is to create your own new repo.
Go to https://github.com/new and make a new repo. Do not initialize with README.
Scroll down to get your git remote
Then:
git remote rm origin
git config master.remote origin
git config master.merge refs/heads/master
// Run code from above image
git push --set-upstream origin yourbranchname
You will have a new repo with the original repo's code and a branch that can be made into a pull request.
SOLUTION:
For remote repository on GitHub and local repository
After fork all branches to your GitHub repository, you can delete Redundant branches in your GitHub repository.
And then you can only clone the branches you need to local.
Step One
Step Two
Only For local repository
git clone -b <branch name> --single-branch <repository>
If you want to further save your disk space, you can clone remote repository without history:
git clone -b <branch name> --depth 1 <repository>
notice: --depth implies --single-branch unless --no-single-branch is given.
https://git-scm.com/docs/git-clone
Switch to the branch you need in source repo
Click "Fork". You'll get forked master and the branch you're in.
I don't know how it works with more branches, but for my needs worked pretty well.