Skip to content

Instantly share code, notes, and snippets.

@nemesisqp
Created December 3, 2017 08:35
Show Gist options
  • Save nemesisqp/07689449bf526086fa6b6983e1053272 to your computer and use it in GitHub Desktop.
Save nemesisqp/07689449bf526086fa6b6983e1053272 to your computer and use it in GitHub Desktop.
script-ea-bash
#!/bin/bash
settingFile=setting.conf
logFile=result
. $settingFile
fullGitHttpUrl="${gitHttpUrl:0:8}$username:$password@${gitHttpUrl:8}"
repoNameWithDotGit=`basename "$fullGitHttpUrl"`
repoName="${repoNameWithDotGit:0:-4}"
# clone repo
git clone --progress $fullGitHttpUrl > "$logFile" 2>&1
cd $repoName
# create and clone gh-pages branch
mkdir -p $buildFolder
cd $buildFolder
git clone --progress -b gh-pages $fullGitHttpUrl . >> "../../$logFile" 2>&1
#!/bin/bash
settingFile=setting.conf
logFile=result
. $settingFile
fullGitHttpUrl="${gitHttpUrl:0:8}$username:$password@${gitHttpUrl:8}"
repoNameWithDotGit=`basename "$fullGitHttpUrl"`
repoName="${repoNameWithDotGit:0:-4}"
cd "$repoName/$buildFolder"
git pull origin gh-pages -s recursive -X ours > "../../$logFile" 2>&1
git add . >> "../../$logFile" 2>&1
git commit -m "%datetime%" >> "../../$logFile" 2>&1
git push origin HEAD:gh-pages >> "../../$logFile" 2>&1
gitHttpUrl="https://github.com/asv/test-aaa-bash-repo.git"
username="user"
password="pass"
buildFolder="build"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment