aboutsummaryrefslogtreecommitdiffstats
path: root/mypath/gitadd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mypath/gitadd.sh')
-rwxr-xr-xmypath/gitadd.sh68
1 files changed, 25 insertions, 43 deletions
diff --git a/mypath/gitadd.sh b/mypath/gitadd.sh
index 79e750f..0ac59fa 100755
--- a/mypath/gitadd.sh
+++ b/mypath/gitadd.sh
@@ -1,45 +1,27 @@
1#!/bin/bash 1#!/bin/bash
2 2
3read -p "Local repo name: " local_name 3##########################################################################
4read -p "Remote repo name: " remote_name 4# File Name : gitadd.sh
5 5# Encoding : utf-8
6# 远程仓库创建 6# Author : We-unite
7tmp="ssh aliyun-git git init --bare $remote_name.git" 7# Email : weunite1848@gmail.com
8eval "$tmp" 8# Created Time : 2024-03-21 19:26:53
9 9##########################################################################
10# 本地仓库创建 10
11mkdir "$local_name" 11set -e
12cd "$local_name" 12
13git init 13repo_name=""
14 14# 判断参数个数
15# 本地仓库初始化 15if [ $# -ne 1 ]; then
16# 编写.gitignore 16 echo "Input repository name: "
17cat > .gitignore << EOF 17 read name
18*.sh 18 repo_name=$name
19*.bat 19else
20*.exe 20 repo_name=$1
21*.[oa] 21fi
22*.pyc 22
23__pycache__ 23sudo -u git -H bash -c "cd ~ && git init --bare $repo_name.git"
24*.vscode 24echo "Input description for the repository:"
25*.swp 25read desc
26EOF 26sudo -u git -H bash -c "echo $desc > ~/$repo_name.git/description"
27 27echo "Repository $1.git created successfully!"
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