aboutsummaryrefslogtreecommitdiffstats
path: root/mypath/gitadd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mypath/gitadd.sh')
-rwxr-xr-xmypath/gitadd.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/mypath/gitadd.sh b/mypath/gitadd.sh
new file mode 100755
index 0000000..79e750f
--- /dev/null
+++ b/mypath/gitadd.sh
@@ -0,0 +1,45 @@
1#!/bin/bash
2
3read -p "Local repo name: " local_name
4read -p "Remote repo name: " remote_name
5
6# 远程仓库创建
7tmp="ssh aliyun-git git init --bare $remote_name.git"
8eval "$tmp"
9
10# 本地仓库创建
11mkdir "$local_name"
12cd "$local_name"
13git init
14
15# 本地仓库初始化
16# 编写.gitignore
17cat > .gitignore << EOF
18*.sh
19*.bat
20*.exe
21*.[oa]
22*.pyc
23__pycache__
24*.vscode
25*.swp
26EOF
27
28# 编写push.sh
29cat > push.sh << EOF
30git add .
31git commit
32git push
33EOF
34chmod +x push.sh
35
36# 提交初始化commit
37git add .
38git commit -m "Initial commit"
39tmp="git remote add origin aliyun-git:$remote_name.git"
40eval "$tmp"
41git push --set-upstream origin master
42git push
43
44echo "Success!"
45