Git is a distributed version control system which is originally written by Linus Torvalds and used for the management of the code. After the launch, Git also achieved great success in other projects, especially in the Ruby. At present, many well-known projects are using a Github as version control system for managing their code.
Here we learn how to manage code in github.
In this article, we will describe about to manage your code into the GitHub.So, To manage your code on Github, you need a GitHub account, if you have not registered with Github yet, please go on URL https://github.com/ and register.
If you are already registered with GitHub account, Log in to your Github account and follow the below steps
1. Open a browser,log in to your GitHub account and create a new repository as shown:
2. Next, jump to the next page, enter repository name such as TestCreativedev or according to your project. Here you can select repository type which is private or public. You can create the private repository with a premium membership. You can also initialize readme on this page.
3. Click on “Create Repository” button and GitHub automatically create a repository and give you a simple command for this project to host your file.
4. Now you have your repository URL on Github which is known as Clone URL and you can find it out on the right side of your repository.
5.Your GitHub repository is ready to use.Open a terminal and enter a new repository clone URL on the command line through command prompt.
6. Once you enter git clone URL on the terminal, it will ask for Username and Password so then enter the account Username and password.Your repository will be copied to your local system.
Now,let’s see some basic useful Github commands:
1) touch README.md : This command will create a README.md file where you can add information about your project.
2) git init : This command is used to initialize a local git repository and generate hidden .git directory
3) git add filename: This command is used to add files to the repository.
4) git commit -m “first commit”: This command is used to commit described files to GitHub with message and it will not up your changes to GitHub server until you push changes.
5) git remote add origin URL: This command in git add the local repository origin and the specified remote repository address.
6) git push origin master: This command will push local commits data to the specified remote master branch.
7) git status: This command will provide the status information of repository.
8) git pull:This command is used to pull the content on the remote host.
Hope this article shed some light to GitHub novices.If you have any query, you can ask here in the comment section.