In this sharing post, I will share the following content:
- Create Repository on Github
- Push code
- Invite member
- Pull the code back
1. What is Repository?
Repository, also known as Repo, is the place where all source code for a project is managed by Github. You can also understand another way that the main Repo declares the directory that contains your project on local or remote. Each Repo has two data structures, the Object store and the Index, which are stored hidden in the .git directory.
There are two types of Repo: local Repo and remote Repo:
Local Repo: A repo installed on an individual’s computer, this repo will synchronize with the remote repo using Git commands. Remote Repo: A repo that is installed on a dedicated server, typically Github.
1. Create Repo on Github
- We use a personal email to register for an account on Github.
- How to create a Repo on Github as follows:
Create Repo
- Go to the link of the Github site: https://github.com/
- In the upper right corner of the screen Click [+] and select [New repository] item
- Enter the name of Repo you want to create => Click the button [Create repository]
- Select the [Public] radio button, everyone can see your code
- Modified to [Private], no one can see your code except you.
- While the change permission will require to enter the password confirm as follows:
- You enter your Github PW account you have changed the Permission from Public => Private successfully.
So you have created a Repo with the link: https://github.com/TrinhThiMyDuyen/Part1
2. Share your code on a joint project
Step 1: Share Project
Right-click the project name => Team => Share Project
Step 2: Create a .git folder in the project
Step 3: Don’t put the test-output folder up
Right click on the test-output folder => Team => Ignore
Step 4: Add index for all files in the project (Put code on Repo)
Right-click the project name => Team => Add to Index
Step 5: Commit file
Select any file you want to commit => Commit message (Enter the commit content) => Commit and Push / Commit
Step 6: Push the code to where you want to go to Git (Here I want to push to the Repo created above: https://github.com/TrinhThiMyDuyen/Part1 )
Step 7: Push successfully and test
Successful push will display a dialog like this:
Check Code just Push successfully on Repo
3. Invite member to view your code on Git
Setting => Manage access => Invite a collaborator => Enter the user’s email on Git that you want to share
4. Clone code
Import Project => Git => Project from Git => Clode URI
Select the repo link that you created initially: https://github.com/TrinhThiMyDuyen/Part1
5. Pull the code back
CONCLUDE:
Creating a repository of code is Repo, commit code, push code, clone code … is a simple but regular job for each developer or an Automation tester. This article by me as a guiline to help you new to Git get the most complete.
There is a note to you that always remember when doing code that before doing it, pull it back after finishing it, push it up.
Thanks!