I am using ansible to deploy my app. I am cloning the app from github using the following:
- name: Deploy site files from Github repository
sudo: yes
git: repo=git#github.com:xyz/abc.git dest=/home/{{deploy_user}}/{{app_name}} key_file=/home/ubuntu/.ssh/id_rsa accept_hostkey=yes force=yes
I want to clone a specific branch from the repository. I read the documentation of ansible but couldn't find any option to clone a specific branch. It has an option to clone a version but not branch.
From the documentation:
version
What version of the repository to check out. This can be the full 40-character SHA-1 hash, the literal string HEAD, a branch name, or a tag name.
(emphasis mine)
Use version, here's the example from the docs:
- git:
repo: git://foosball.example.org/path/to/repo.git
dest: /srv/checkout
version: dev
Related
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
I created a new repo on github and added the .travis.yml file and some sphinx documents but travis won't trigger a build. I can push to another older repository and https://travis-ci.org builds fine. I double checked that the .travis.yml file is exactly like other repositories that do build. I checked github Authorizing OAuth Apps and travis is there.
.travis.yml
language: python
install:
- pip install sphinx sphinx_rtd_theme mock
script:
- sphinx-build -Wv docs/source docs/html
deploy:
# publish docs on push
- provider: pages
skip_cleanup: true
keep-history: false
github_token: $GH_TOKEN
local_dir: docs/html
on:
branch: master
I made a second repo just to make sure I did it correctly.
I follow my instructions for setting up a GitHub, sphinx and travis each time I create a repo.
My gitlab-ci.yaml:
stages:
- linter
- build
- deploy
include:
- project: 'infrastructure/ansible-repository'
ref: '1.0.0'
file: '/project-pipeline.yml'
In the project-pipeline.yml there's a before_script: where I need to access a directory from the infrastructure/ansible-repository. At the moment I git clone the whole repository.
My Question: is there an include for a directory or something like that?
It seems you are looking for a way to download a sub directory from a remote repository. Based on which repository hosting platform (E.g. GitLab, GitHub, BitBucket and ...) you used Or your interaction with that directory there are many solutions. Such as git archive, git clone --filter, svn tool, wget, sparse checkout and so on, which all
described in this helpful post:
How do I clone a subdirectory only of a Git repository?
There is very little documentation about how to create a Portfile using a github repo HEAD and pulling from origin/master or tag.
are checksums needed? if so, how to calculate?
how to pull a PR from a different repo/fork?
for example
PortSystem 1.0
name zimg
version 1.0
categories multimedia
maintainers nomaintainer
description Colorspaces: SMPTE-C (NTSC)
homepage https://github.com/sekrit-twc/zimg
distname ${name}
fetch.type git
git.url https://github.com/sekrit-twc/zimg.git
git.branch origin/master
how to pull a PR from a different repo/fork?
If you have the ID of the PR, as mentioned in "Checking out pull requests locally", the fetch URL would be
git fetch origin pull/ID/head:BRANCHNAME
Applied to a porfile, with fetch.type set to git, you can try as a branch name
git.branch origin/pull/ID/head
As neverpanic adds in the comments:
Note that while you can set fetch.type git and git.branch origin/master, this is not supported by MacPorts.
It's fine for development, but when trying to get a Portfile included in MacPorts, we expect that a certain version of the Portfile will always produce the same result, regardless of when you install it.
For git submodules, add post-fetch { system -W ${worksrcpath} "${git.cmd} submodule update --init" } together with fetch.type git.
I just created a great gallery for my Jekyll blog which builds perfectly on my localhost:4000. However, GitHub pages doesn't support the Jekyll Gallery Generator plug-in I am using: https://github.com/ggreer/jekyll-gallery-generator
I read about the alternative method of hosting Jekyll on a traditional host using FTP (uploading the _site directory) http://jekyllrb.com/docs/deployment-methods/ However, rather than reconfigure my entire site and hosting, It would be great if GitHub Pages could be used somehow even though I'm using a non-supported plugin.
What is a workaround for this?
Depending if you deal with a User/Organization (UO) site or a Project site (P), do :
from your working folder git init
git remote add origin git#github.com:userName/userName.github.io.git (UO) or git remote add origin git#github.com:userName/repositoryName.git (P)
jekyll new . creates your code base
in _config.yml, set the baseurl parameter to baseurl: '' (UO) or baseurl: '/repositoryName' (P)
in .gitignore add _site, it will be versioned in the other branch
jekyll build will create the destination folder and build site.
git checkout -b sources (UO) or git checkout master (P)
git add -A
git commit -m "jekyll base sources" commit your source code
git push origin sources (UO) or git push origin master (P) push your sources in the appropriate branch
cd _site
touch .nojekyll, this file tells gh-pages that there is no need to build
git init init the repository
git remote add origin git#github.com:userName/userName.github.io.git (UO) or git remote add origin git#github.com:userName/repositoryName.git (P)
git checkout master (UO) or git checkout -b gh-pages (P) put this repository on the appropriate branch
git add -A
git commit -m "jekyll first build" commit your site code
git push origin master (UO) or git push origin gh-pages (P)
You now have something like Octopress does. Look at their rake file, there are some nice comments inside.
Better way is to configure Travis to automate deployment of jekyll with non-supported plugins. Follow Travis getting started guide to enable Travis for your repo.
Create script/cibuild with the following content
#!/usr/bin/env bash
set -e # halt script on error
bundle exec jekyll build
touch ./_site/.nojekyll # this file tells gh-pages that there is no need to build
Create .travis.yml with the following content (modify as required)
language: ruby
rvm:
- 2.3.3
before_script:
- chmod +x ./script/cibuild # or do this locally and commit
# Assume bundler is being used, therefore
# the `install` step will run `bundle install` by default.
script: ./script/cibuild
# branch whitelist, only for GitHub Pages
branches:
only:
- master
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
sudo: false # route your build to the container-based infrastructure for a faster build
deploy:
provider: pages
skip_cleanup: true
keep-history: true
local_dir: _site/ # deploy this directory containing final build
github_token: $GITHUB_API_KEY # Set in travis-ci.org dashboard
on:
branch: master
Deployment steps (after every push):
Build will be created using our custom script script/cibuild in _site directory
_site will be pushed to gh-pages branch.
github pages will serve site as it is without building it again (because of .nojekyll file)
Reference: My repository https://github.com/armujahid/armujahid.me/ is using this method for continuous integration using Travis CI