DEV Community

Cover image for How to Create a New Reposiorty on Github
SardiusJay
SardiusJay

Posted on

How to Create a New Reposiorty on Github

Introduction
There are different means of pushing your project to GitHub, it can be done manually on your Github account by dragging and dropping the file to your account or making use of Git Command and there is the advantage of using git to push to your GitHub account, But first, you must have a Github account that will help you to be able to connect it with your git and you can make use of your terminal or your command prompt as a window user but it is always advisable to use your Git.

Definition
What is Git?

Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

What is Github?
GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. This tutorial teaches you GitHub essentials like repositories, branches, commits, and pull requests.

Personal Experience when I refuse to push my project to Github
As a developer, there is always a need for you to save your project. Still, funny enough some people will say they have their Hard disk and their external storage to keep their folders and project or probably their flash drive, but am sharing this because of the problem I faced some months ago after doing numbers of the project and my hard disk got crashed I was very sad and unhappy but everything I worked for both day and night was gone. Still, some came back to me that have some of my projects pushed to my Github account I mean I was so glad and happy to continue with my project after a long period.

But come to think of it, sharing my side of the story is just to let you know that saving money in the bank is good and likewise saving (pushing) your project online(Github) is very important, I like to give you the steps needed to push your project on GitHub with ease

Let's Go

Steps involved pushing your project on Github
The following is the command for git on how to push to GitHub, The following will guide you on how to push your code to Github by using git

Step 1:- Open your Github Account, Click on New which will direct you to create a new repository

github image 1

Step 2:- If you have an existing repository, then open that repository, otherwise, click on the "New" button to create a repository.

Step 3:- Enter the name and description(in which it is optional) for the repository. Then click on public or private Repository whatsoever you want to change yours to according to the requirement. Select the checkbox if you want to initialize the repository with a README

github image 2

Step 4:- Then, Open your Vs code or your terminal or which one you are using but like Gitbash is still advisable for window users

Step 5:- On Your Github account there will be some codes on it, which you will need to copy and paste onto your terminal

github image 3

Step 6:- The Code creating a new repository on the Command Line

echo "# pushing-project" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/SardiusJay/pushing-project.git
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

Then, For an existing Repository

git remote add origin https://github.com/SardiusJay/pushing-project.git
git branch -M main
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

Conclusion

Hope you enjoy it and now understand how to add a new repository to your GitHub account, Watch out for my next article very soon!!!! hope you learned something new. and in my next article I will be discussing how to push your project to your Github using Git(a Version control sytem)

Share with me your idea in the comment below about how this content has really helped you🤓🤓🤓

Top comments (2)

Collapse
 
bcostaaa01 profile image
Bruno • Edited

Saving money on hard/external storage and using GitHub as a sort of “backup” are not the only the advantages of using the platform… but having shared your own personal experience with it is valuable for any beginner developer.

Some other important points I would mention regarding using the advantages of using GitHub:

  • you can contribute to open source and let others contribute to your own open source software.
  • you can use GitHub’s Codespaces if you want to take your environment to another device, as long as the server is running on your main environment.
  • you can create documentation for your project.
  • track changes across your commits/“versions” of your codebase.
  • use GitHub’s integrated tools such as Actions, which is really great as you can automate a lot your work when it comes testing - it tests after you make a commit on an open pull request.

Also, watch out for the word “Code” on the commands when you explain how to commit and push to a remote GitHub repository: it should be “commands” instead.

You could have also explained how to open a pull request, which is as easy as comparing the changes after making a push to the repo and opening a PR.

I don’t think dragging a file would be as convenient though. I think using the terminal in the code editor would be way more convenient as it does so for you without having to drag windows throughout your laptop/setup, and you know exactly what code you are pushing to the repo.

Collapse
 
sardiusjay profile image
SardiusJay

Bruno, Thank you very much for this great contibution.