setup_git 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env bash
  2. # Some constant colors
  3. DEFAULT="\e[39m"
  4. GREEN="\e[32m"
  5. CYAN="\e[96m"
  6. RED="\e[91m"
  7. YELLOW="\e[93m"
  8. # title function
  9. title () {
  10. clear
  11. echo -e "${CYAN}###########################################"
  12. echo -e " Setting up a Github repository"
  13. echo -e "###########################################${DEFAULT}"
  14. echo
  15. }
  16. prompt() {
  17. echo -e -n "${YELLOW}$1 ${DEFAULT}"
  18. read $2
  19. }
  20. showdone() {
  21. echo -e "${CYAN}###########################################"
  22. echo -e " All done, have fun :)"
  23. echo -e "###########################################${DEFAULT}"
  24. echo
  25. }
  26. # echo "# Simple git-tools" >> README.md
  27. # git init
  28. # git add README.md
  29. # git commit -m "first commit"
  30. # git remote add origin https://github.com/ArchWiz/git-tools.git
  31. # git push -u origin master
  32. # git config --global user.name x
  33. # git config --global user.email x
  34. # sudo git config --system core.editor nano
  35. # git config --global credential.helper cache
  36. # git config --global credential.helper 'cache --timeout=3600'
  37. # Force git to overwrite local files on pull - no merge
  38. # git fetch all
  39. # git push --set-upstream origin master
  40. # git reset --hard orgin/master
  41. if ! location="$(type -p 'git')" || [ -z "git" ]; then
  42. echo
  43. "${RED}#########################################################"
  44. echo "Installing git for this script to work"
  45. echo
  46. "#########################################################${DEFAULT}"
  47. sudo apt install git -y
  48. fi
  49. # Setting up git
  50. #
  51. https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-config
  52. title
  53. prompt "Pleace specify your full name:" fullname
  54. prompt "Pleace specify your e-mail adres:" email
  55. #prompt "Please specify Github username:" username
  56. prompt "Please specify Repository name:" repository
  57. username="Archwiz_Linux"
  58. git init
  59. git config --global user.name "${fullname}"
  60. git config --global user.email "${email}"
  61. sudo git config --system core.editor nano
  62. git config --global credential.helper cache
  63. git config --global credential.helper 'cache --timeout=3600'
  64. git config --global push.default simple
  65. git remote add origin https://notabug.org/${username}/${repository}.git
  66. showdone