Rust API for Gitea, automatically generated https://git.exmods.org/swagger.v1.json
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

53 lines
1.5KB

  1. #!/bin/sh
  2. # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
  3. #
  4. # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
  5. git_user_id=$1
  6. git_repo_id=$2
  7. release_note=$3
  8. if [ "$git_user_id" = "" ]; then
  9. git_user_id="GIT_USER_ID"
  10. echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
  11. fi
  12. if [ "$git_repo_id" = "" ]; then
  13. git_repo_id="GIT_REPO_ID"
  14. echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
  15. fi
  16. if [ "$release_note" = "" ]; then
  17. release_note="Minor update"
  18. echo "[INFO] No command line input provided. Set \$release_note to $release_note"
  19. fi
  20. # Initialize the local directory as a Git repository
  21. git init
  22. # Adds the files in the local repository and stages them for commit.
  23. git add .
  24. # Commits the tracked changes and prepares them to be pushed to a remote repository.
  25. git commit -m "$release_note"
  26. # Sets the new remote
  27. git_remote=`git remote`
  28. if [ "$git_remote" = "" ]; then # git remote not defined
  29. if [ "$GIT_TOKEN" = "" ]; then
  30. echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
  31. git remote add origin https://${git_repo_id}.git
  32. else
  33. git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_repo_id}.git
  34. fi
  35. fi
  36. git pull origin master
  37. # Pushes (Forces) the changes in the local repository up to the remote repository
  38. echo "Git pushing to https://${git_repo_id}.git"
  39. git push origin master 2>&1 | grep -v 'To https'