sh github-deploy-clone.sh
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh github-deploy-clone.sh相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env bash
read -r -d '' usage << EOM
Usage:
gh-deploy-clone user/repo [ENVIRONMENT]
EOM
[ -z "$1" ] && echo && echo "$usage" && echo && exit 1
repo="$1"
repo_name="${repo#*/}"
env=$([ -n "$2" ] && echo "$2_" || echo)
key="github_$env$repo_name"
key_path="$HOME/.ssh/$key.rsa"
cat >> "$HOME/.ssh/config" << EOM
Host $repo_name.github.com
HostName github.com
User git
IdentityFile $key_path
IdentitiesOnly yes
EOM
ssh-keygen -f "$key_path" -N '' -t rsa -C "$key"
echo
echo
echo Add the deploy key below to
echo "https://github.com/$repo/settings/keys"
echo and press enter to clone the repo.
echo
echo
cat "$key_path.pub"
echo
echo
read -p "Press enter to continue..." </dev/tty
git clone "git@$repo_name.github.com:$repo.git"
以上是关于sh github-deploy-clone.sh的主要内容,如果未能解决你的问题,请参考以下文章
如何使我的命令行在具有扩展名(.sh)和名称如“weird.sh.sh.sh”的文件上工作
sh sh_template.sh
sh sh.sh
Linux下面如何运行 SH文件
配置告警系统主脚本main.sh mon.sh load.sh 502.sh disk.sh
shell 脚本各种执行方式(source ./*.sh, . ./*.sh, ./*.sh)的区别