Github
GitHub is a Git repository hosting service, web-based. It offers all of the distributed version control and SCM (source code management) functionality of Git as well as adding its own features. It provides several collaboration and access control features such as bug tracking, feature requests, task management. GitHub offers both plans for free repositories on the same account which are commonly used to host open-source software projects and private repositories.
There are two ways to add project in Github as following:
- Directly from Android Studio.
- Using the Command line (Terminal).
Today, We will learn about add project to Github using the command line (Terminal).
Steps for adding an existing project to Github using the command line:
- First of all Login og Sign Up on Github.
- After that you will see the plus sign on the right corner of your screen. From that select New Repository.
- Then you will see the new window , Where you can enter your repository name like TestRepository.
- After that your repository will be created. Now you can see Quick setup Window in front of you. Here you can see your HTTPS and SSH url.
- Now open you Terminal.
- Then after you have to change your current working directory to your local project directory. For that you have to fire “cd” command with your project directory path.
Shortcut:
- Type “cd” command and directly drag and drop your project directory to the terminal. You will see the full path of your local project directory.
- Type “cd” command and just copy your project directory and paste after “cd” command. You will get full path of your local project directory.
Then you will redirect to your local project directory.
- Now initialize your local project directory as a Git repository using “init” command.
- Now add all your files to the new local project directory.
- After adding all files, You have to commit that staged files by particular tag just for your remind like “test commit”.
- From the Quick Setup Window copy Repository URL.
- In terminal add your repository URL for the remote repository, Where your local project repository will we pushed. This command will sets new remote for your repository.
- Now push all changes of your local project repository to the Github. It will push all code to the Github.
Finally, your local repository placed in Github. Now you can see your project in your Github repository.