Signup
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:
1 2 |
.htaccess data.inc.php |
Upload local files
First preparation:
1 2 3 4 |
apt-get install git cd [yourlocalpath]/testrepo git init git remote add testrepo https://github.com/[yourUsername]/testrepo |
Add and upload all files:
1 2 3 4 5 6 |
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:
1 2 3 4 |
#modify a file git add -A git commit git push testrepo |
Comments