How to Upload Your Code On Github by Using the Git Command? — Devstringx
What is GIT?
Before writing this blog First, we will understand what is GIT?
Git was developed by Linus Torvalds on 7 April 2005. And Git is a DevOps tool used for source code management. And Git is a free and open-source version control system used to handle small to very large projects efficiently. Git is used to tracking the changes in the source code enabling multiple developers to work together on non-linear development. And Git allows the developers to work together. Git supports non-linear development through its thousand parallel branches.
Git Flow
Here we are showing the Git Flow by using the diagram then you will understand it in depth.
Let’s come to the point. Here we will discuss how to upload the project on GitHub
Step to Follow While Uploading Project On GitHub
Here are some steps that you have to follow while uploading your project on GitHub
- New Repository: Select the new repository option on your registered GitHub account
2. Create a New Repository: after clicking on the new repository option then you will land on the create a new repository page Type the project name in the text field under “Repository Name” and press the green.
3. Once you redirect to the new page, highlight and copy the following line.
4. Now in further point you have to set your local project to the present working directory in the terminal and run the further given commands
git init: To initialize the local directory as a Git repository.
add. git: With the help of this command you can add the files to the new local repository.
git status: This command will display all the files staged for commit.
Let’s have a look for example:
Recommended to Read:- Guide On Gitlab Test Case Management Tool
5. Now all the files are staged and ready for the first commit. And command that we will use
git commit -m “enter the message that you want”
6. Now you have to specify the remote repository URL that you have seen in step 3 and hit enter
7. This is last but not least. Now you have to push your code to the local repository in GitHub. And you have to use the command for this: git push -u origin master
8. Now open your Github account and view all the files of your project inside the repository that you created initially.
Overall summarize by using the above steps you will successfully push your code into GitHub.
Originally published at https://www.devstringx.com on September 19, 2022