INTRODUCTION
- Github is the web-based version control system.
- A user can maintain public(free) or private(paid) repositories.
- It also offers wikis, bug tracking, and management features.
In this article, we are going to learn
- How to do initial Github setup in windows
- How to add projects
- How to add new files to the existing project.
Make sure you have installed Github into your machine.
INITIAL SETUP
- Create a new repository (e.g: testupload)
- Create a new folder on your computer (windows) - "testupload" under c: drive
- Create any file (e.g: test.txt) with some content (e.g: this is a test text file)
- Open GitBash Application and go to the location c:\testupload
- Enter command: git init
- If success, .git folder will be created under c:\testupload
- Enter below command to add file(s):
- Command to add single file: git add test.txt
- Command to add all files: git add .
- Enter below command to commit the file
git commit -m "test file added"
- Enter below command to push the file into online Repository.
- Command: git remote add origin https://github.com/javabyranjith/testupload.git
- Command: git push -u origin master
- Enter your github username
- Enter your github password
- Now check the online repository
ADD MORE FILES
- Add a file (HelloWorld.java) into the local folder c:\testupload
- Enter below commands
- > git add .
- > git commit -m "Hello world java file added"
- > git push
- > Enter your github username
- > Enter your github password
REMOVE FILES/FOLDER
- > git rm -r --cached <DirectoryName/File>
- > git commit -m "Removed Directory"
- > git push origin master
- > Enter username
- > Enter password