Last Updated on 2017-04-21.
Create an account on www.github.com, should be self-explaining.
Also create a repository; I will call it “testrepo” in this tutorial.
We will use a Ubuntu VM as local machine in this case.
Prepare local directory
I suppose you already have a local project directory which contains all the files you want to upload.
If you use any personal user credentials in your project, please transfer the data to a separate file.
E.g. if you have a file like data.inc.php, also create a neutral file data.inc.php.sample.
Then create a file .gitignore with the contents you do not want to be uploaded:
Upload local files
apt-get install git cd [yourlocalpath]/testrepo git init git remote add testrepo https://github.com/[yourUsername]/testrepo
Add and upload all files:
git pull testrepo master git add . #or git add -A git commit #add a comment and close the editor git push testrepo
Modifying a file is quite similar:
#modify a file git add -A git commit git push testrepo