How to Deploy a Local Project onto Github
2017-02-13
This passage covers the major steps of deploying your local project (files in a well-structured folder) onto a Github repository. Here we take ~/Desktop/XGBoost
as an example, in which I have three Python
scripts and a Readme.md
doc. Make sure you have the command line tool Git
installed already.
(1) Open Terminal.app
and enter the directory of the folder.
cd ~/Desktop/XGBoost
(2) Initialize the directory to a Git
project.
git init
Now you’ll see a .git
file (which is hidden actually, but you can opt to show hidden files using terminal commands) in the folder XGBoost
.
(3) Add all files into the local Git
project.
git add .
You can substitute .
with the files you want to add, e.g. main.py
, if not all items in the directory do you want to deploy.
(4) Deploy your local project to Github
.
git commit -m "Initial commit"
(5) Visit Github
. Create a new repository named XGBoost
or whatever. Copy the .git
url of your repository, e.g. https://github.com/allenfrostline/xgboost.git
(6) Go back to the terminal and type the following.
git remote add origin https://github.com/allenfrostline/xgboost.git
(7) Run the following script to see if you’ve seccessfully deployed your files.
git remote -v
(8) Any time in the future if you want to deploy/update your files, run under the same directory:
git push origin master
Refference: Adding a file to a repository using the command line