Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 16

ridge/java-tutorial

forked from turnon/java-tutorial
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (11)
master
gh-pages
dependabot/maven/codes/javatool/javatool-monitor/javatool-zipkin-spring/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/javaee/javaee-taglib/xerces-xercesImpl-2.12.2
dependabot/maven/codes/javaee/javaee-jstl/xerces-xercesImpl-2.12.2
dependabot/maven/codes/javatool/javatool-monitor/javatool-zipkin-spring/org.apache.logging.log4j-log4j-core-2.17.1
dependabot/maven/codes/javaee/javaee-oss/org.jsoup-jsoup-1.14.2
dependabot/maven/codes/javaee/javaee-oss/org.bouncycastle-bcprov-jdk15on-1.67
dependabot/maven/codes/deadloop/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/trouble-shooting/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/java-distributed/java-load-balance/junit-junit-4.13.1
master
Branches (11)
master
gh-pages
dependabot/maven/codes/javatool/javatool-monitor/javatool-zipkin-spring/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/javaee/javaee-taglib/xerces-xercesImpl-2.12.2
dependabot/maven/codes/javaee/javaee-jstl/xerces-xercesImpl-2.12.2
dependabot/maven/codes/javatool/javatool-monitor/javatool-zipkin-spring/org.apache.logging.log4j-log4j-core-2.17.1
dependabot/maven/codes/javaee/javaee-oss/org.jsoup-jsoup-1.14.2
dependabot/maven/codes/javaee/javaee-oss/org.bouncycastle-bcprov-jdk15on-1.67
dependabot/maven/codes/deadloop/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/trouble-shooting/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/java-distributed/java-load-balance/junit-junit-4.13.1
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (11)
master
gh-pages
dependabot/maven/codes/javatool/javatool-monitor/javatool-zipkin-spring/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/javaee/javaee-taglib/xerces-xercesImpl-2.12.2
dependabot/maven/codes/javaee/javaee-jstl/xerces-xercesImpl-2.12.2
dependabot/maven/codes/javatool/javatool-monitor/javatool-zipkin-spring/org.apache.logging.log4j-log4j-core-2.17.1
dependabot/maven/codes/javaee/javaee-oss/org.jsoup-jsoup-1.14.2
dependabot/maven/codes/javaee/javaee-oss/org.bouncycastle-bcprov-jdk15on-1.67
dependabot/maven/codes/deadloop/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/trouble-shooting/org.apache.httpcomponents-httpclient-4.5.13
dependabot/maven/codes/java-distributed/java-load-balance/junit-junit-4.13.1
java-tutorial
/
scripts
/
git-clone.sh
java-tutorial
/
scripts
/
git-clone.sh
git-clone.sh 2.90 KB
Copy Edit Raw Blame History
turnon authored 2019年10月29日 21:17 +08:00 . update
#!/usr/bin/env bash
#
# 检查脚本参数,如必要参数未传入,退出脚本。
#
checkInput() {
if [ "${repository}" == "" ] || [ "${branch}" == "" ]; then
echo "请输入脚本参数:repository branch [source] [target]"
echo " repository: git 仓储(必填)。"
echo " branch: git 分支(必填)。如 master/develop"
echo " source: 代码存放目录。默认为/home/zp/source。"
echo " target: 代码存放目录。默认为脚本所在目录。"
exit 0
fi
}
#
# 判断 git 版本库是否存在。根据实际结果修改 ${gitok} 值。
#
gitok=false
isGitExist() {
cd ${SOURCE_PATH}
if [ -d "${SOURCE_PATH}/${repository}/${target}" ]; then
cd ${SOURCE_PATH}/${repository}/${target}
#(1)删除git状态零时文件
if [ -f "gitstatus.tmp" ]; then
rm -rf gitstatus.tmp
fi
#(2) 判断是否存在.git目录
if [ -d "./.git" ]; then
#(3) 判断git是否可用
git status &> gitstatus.tmp
grep -iwq 'not a git repository' gitstatus.tmp && gitok=false || gitok=true
fi
#返回到主目录
cd ${SOURCE_PATH}
fi
}
#
# 如果 git 版本库存在(根据 ${gitok} 值),执行 fetch 操作;反之,执行 clone 操作。
#
doFetchOrClone() {
if [ ! -d "${SOURCE_PATH}" ]; then
mkdir -p ${SOURCE_PATH}
fi
if ${gitok}; then
cd ${SOURCE_PATH}/${repository}/${target}
git reset --hard
git clean -ffdx
git fetch
echo "git fetch ${repository} remote repository 到本地成功"
else
#删除所有内容,便于重新进行git clone
rm -rf ${repository}
git clone --no-checkout git@github.com:${ACCOUNT}/${repository}.git ${SOURCE_PATH}/${repository}/${target}
echo "git clone ${repository} remote repository 到本地成功"
cd ${SOURCE_PATH}/${repository}/${target}
fi
}
#
# 切换到 ${branch} 分支
#
doCheckout() {
echo "检出 ${repository}${branch} 分支代码"
isRemoteBranch=false
gitRemoteBranch=`git branch -r`
echo -e "$gitRemoteBranch" | grep -iwq ${branch} && isRemoteBranch=true || isRemoteBranch=false
if ${isRemoteBranch}; then
echo "找到 ${branch} 对应的远端分支"
git checkout -f 'origin/'${branch}
else
git checkout -f ${branch}
fi
echo "更新子模块代码"
git submodule update --init --recursive --force
}
##############################__MAIN__########################################
export LANG="zh_CN.UTF-8"
# Github 账户
ACCOUNT=dunwu
# 源码默认根目录
SOURCE_PATH=/home/zp/source
# 必填输入参数
repository=`echo 1ドル`
branch=`echo 2ドル`
# 可选输入参数
source=`echo 3ドル`
target=`echo 4ドル`
if [ "${source}" != "" ]; then
SOURCE_PATH=${source}
fi
# 0. 检查传入的参数
checkInput
# 1. 判断本地是否已存在 Git 仓库
isGitExist
# 2. 如果本地已有代码,执行 fetch;反之,从远程 clone
doFetchOrClone
# 3. 切换到指定分支
doCheckout
echo "代码检出完成!"
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

:coffee: 老司机在 Java 技术领域的十年积累。
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/lixuelincode/java-tutorial.git
git@gitee.com:lixuelincode/java-tutorial.git
lixuelincode
java-tutorial
java-tutorial
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /