DEV Community

Cover image for Creating & modifying a repository in GitHub
Kumar Kalyan
Kumar Kalyan

Posted on • Edited on

Creating & modifying a repository in GitHub

Hi everyone I am back with a new article of this series, In the last article I have explained the difference between git & GitHub but this article will help you to create a repository in GitHub, all you need for this is just a GitHub account.

Creating a repository

  1. Visit GitHub and then sign in to your account
  2. Click on the new button to create a new repository in the top left
    github new repo

  3. Then add a repository name (tip: use short meaningful names), then add a description in the description field, then set your repo visibility to public or private, in this case I am setting it to public, then add a license I am using MIT you can choose any one of your choices, the click on the create repository button
    creating repo

  4. Now we have successfully created a repository

    repo created

Modifying our repository

In this article we will create, modify and add files to your repository directly from the GitHub

creating a file

Open the repository, that you want to modify or simply visit, https://github.com/<your username >/<repository name >, in this case https://github.com/kum9748ar/github-tutorial

  1. click on the Add file button followed by create new file creating a file
  2. Now add a file name and write something in your file, you can click on the preview tag to see how your file looks like, then add a commit message and commit description (why these things are needed? typically, while working in a team or building a project, you show know that what you have committed(added) and why, let's assume that you have designed a calculator app and hosted your code to GitHub, after a few days you have added a new feature to it, so in this case you can add a commit message like "added a new feature " and description like "this feature will help in exponential calculations" ) now click on the commit new file and this add a new file to your repository commiting a file See now we have created a new file having a commit id (commit id is needed to modify or delete a particular commit ) file with commit id

editing a file

Now let's see that how we can edit our file in GitHub,
Again move back to your GitHub repo and click on go to file
go to file

now click on the pencil icon to edit the file
and now add some more content to your file
file edit
now again add a commit message and description and hit the commit button
commited new file
see we have successfully edited our file with a new commit id

Conclusion

So, guys we have successfully created and modified our repository, feel free to comment you if you have any doubts. In the next article, I will show that how you can push your code or upload files to GitHub Directly from the CLI(Command Line Interfaces), how to revert a commit, branching, pull requests , issues , and many more Git concepts, so stay tuned for the next one.& if you Like it feel free to hit a ❤️

Connect



Top comments (0)