forked from EvidentSecurity/esp-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_push.sh
More file actions
executable file
·54 lines (44 loc) · 1.63 KB
/
git_push.sh
File metadata and controls
executable file
·54 lines (44 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
git_domain=$3
branch=$4
release_note=$5
author=$6
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$git_domain" = "" ]; then
echo "[INFO] No command line input provided. Set \$git_domain"
fi
if [ "$author" = "" ]; then
echo "[INFO] No command line input provided. Set \$author"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
echo "Committing message ${release_note} as ${author}"
git commit -m "$release_note" --author "$author"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
git remote add origin ssh://git@${git_repo_id}.${git_domain}/${git_user_id}/${git_repo_id}.git
fi
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to git@${git_domain}:${git_user_id}/${git_repo_id}.git"
git push -u -f origin $branch