Advertisement
kwabenasapong

Initialise the Code base for AirBnB_clone_v4

Jan 26th, 2023
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.72 KB | Source Code | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # Ask for user input for gitUserId, personal token, and repository name
  4. echo "Enter your GitHub username:"
  5. read gitUserId
  6. echo "Enter your GitHub personal access token:"
  7. read personalToken
  8. echo "Enter the name of the new repository:"
  9. read repoName
  10.  
  11. # Create a new empty repository on the user's GitHub account
  12. curl -u "${gitUserId}:${personalToken}" https://api.github.com/user/repos -d "{\"name\":\"${repoName}\"}"
  13.  
  14. # Clone the repository to the local machine
  15. git clone https://github.com/${gitUserId}/${repoName}.git
  16.  
  17. # Change to the repository directory
  18. cd ${repoName}
  19.  
  20. # Clone the codebase of AirBnB_clone_v3 into the local repository
  21. git clone https://github.com/jzamora5/AirBnB_clone_v3.git
  22.  
  23. # Move the contents of AirBnB_clone_v3 into the root directory of the local repository
  24. mv AirBnB_clone_v3/* .
  25.  
  26. # Remove the empty AirBnB_clone_v3 directory
  27. rm -rf AirBnB_clone_v3
  28.  
  29. # Change the remote URL of the local repository to the new repository on the user's GitHub account
  30. git remote set-url origin https://github.com/${gitUserId}/${repoName}.git
  31.  
  32. # Change the URL in the .git/config file to the new repository on the user's GitHub account
  33. sed -i "s|https://github.com/jzamora5/AirBnB_clone_v3.git|https://github.com/${gitUserId}/${repoName}.git|g" .git/config
  34.  
  35. # Add, commit, and push the changes to the new repository
  36. git add .
  37. git commit -m "Update ${repoName}"
  38. git push -u origin master
  39.  
  40.  
  41. # ------------------------------------------------------------
  42. sudo apt-get install -y python3-lxml &&
  43. sudo pip3 install flask_cors # if it was not installed yet &&
  44. sudo pip3 install flasgger &&
  45.  
  46. sudo pip3 uninstall -y jsonschema &&
  47. sudo pip3 install jsonschema==3.0.1 &&
  48. sudo pip3 install pathlib2 &&
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement