Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for 2. Setting up your git repository
Kaushik Awala
Kaushik Awala

Posted on • Edited on

     

2. Setting up your git repository

If you haven't already, you can read the article on how to buy a custom domainhere.

For those who have completed the previous step of purchasing your custom domain, let us see how to set up our git repository before moving on to the next step of configuring the GitHub pages to use our custom domain for hosting.

For starters

As Wikipedia says,

GitHub, Inc. is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus its own features.

whereas,

Git is a software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development.

Because this series is about hosting the website on your custom domain using GitHub pages, this article only refers to GitHub repositories.

Adding code to an empty GitHub repository and pushing it there

To host your website code on GitHub, follow the steps below.

  1. Create an empty git repository on GitHub
    GitHub Create Repository

  2. After creating the empty repository, you should see the following instructions.
    GitHub empty repository

  3. Then, using the instructions provided above, develop an app of your choice and push the code to the empty GitHub repository. I'm building my website withVue JS. Vue JS will thus be used in the examples. The difference is simply in the deployment process, and you can use any framework/library to construct your website, such asAngular,React,Svelte, etc. Follow the stepshere to get a project started with Vue JS.

  4. Make sure the project name matches the repository name you created in Step 2.
    Project Name

  5. Change to the newly established Vue project directory. You can now execute the git commands as directed in Step 2.

**Note: If a local git repo is not initialized as part of the project's initialization, use the following command to do so.

$git init
Enter fullscreen modeExit fullscreen mode

Set git config with the following commands to commit and push your changes.

$git config--global user.name"username"$git config--global user.email"user@email.com"
Enter fullscreen modeExit fullscreen mode
  1. After that, run the commands below to push your project code to the empty repository you created in Step 2.
$git add.$git commit-m"<your-commit-message>"$git branch-M main$git remote add origin https://github.com/<github-username>/<repository-name>.git$git push-u origin main
Enter fullscreen modeExit fullscreen mode

You should be able to see your website project code in your GitHub repository after completing the steps above.
GitHub repository after pushing code

Okay, that was a lot of information! This article has finally come to an end. Please read the next part of this serieshere.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

My ideal work culture is Purpose. I'll be the happiest as part of a team that works together to change the world.
  • Location
    Houston, TX
  • Education
    University of Houston
  • Work
    Front End Software Engineer
  • Joined

More fromKaushik Awala

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp