<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Arif Raza</title>
    <description>The latest articles on DEV Community by Muhammad Arif Raza (@muhammad_arifraza_78).</description>
    <link>https://dev.to/muhammad_arifraza_78</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2442296%2Ff485df16-fdf7-4863-ac87-8c7adf285085.jpg</url>
      <title>DEV Community: Muhammad Arif Raza</title>
      <link>https://dev.to/muhammad_arifraza_78</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammad_arifraza_78"/>
    <language>en</language>
    <item>
      <title>How to Create a GitHub Repository from your Terminal</title>
      <dc:creator>Muhammad Arif Raza</dc:creator>
      <pubDate>Sat, 16 Nov 2024 16:14:43 +0000</pubDate>
      <link>https://dev.to/muhammad_arifraza_78/how-to-create-a-github-repository-from-your-terminal-5fc9</link>
      <guid>https://dev.to/muhammad_arifraza_78/how-to-create-a-github-repository-from-your-terminal-5fc9</guid>
      <description>&lt;p&gt;🚀 How to Create a GitHub Repository from Your Terminal&lt;br&gt;
GitHub is a developer’s best friend when it comes to version control and collaboration. While most people use the GitHub web interface to create repositories, did you know you can do it faster directly from your terminal? Whether you're a seasoned developer or just getting started, this guide will show you how to create a GitHub repository straight from the command line using the GitHub CLI.&lt;/p&gt;

&lt;p&gt;🛠 Prerequisites&lt;br&gt;
Before diving in, make sure you have the following tools ready to go:&lt;/p&gt;

&lt;p&gt;Git Installed&lt;/p&gt;

&lt;p&gt;Check if Git is installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
git --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If not, download and install it from git-scm.com.&lt;br&gt;
GitHub CLI (gh) Installed&lt;/p&gt;

&lt;p&gt;Download the GitHub CLI from cli.github.com.&lt;br&gt;
After installation, verify it by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
gh --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A GitHub Account&lt;/p&gt;

&lt;p&gt;Ensure you have an active GitHub account.&lt;br&gt;
🚦 Step-by-Step Guide&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authenticate with the GitHub CLI
Log in to GitHub from your terminal:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
gh auth login
Follow the on-screen instructions to authenticate via your browser or terminal.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Navigate to Your Project Directory
If you already have a project folder, move into it:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
cd /path/to/your/project
If not, create a new directory:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
mkdir my-project  
cd my-project 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Initialize Git
If you haven’t initialized a Git repository in your project folder, do so now:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
git init 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Create the GitHub Repository
Use the GitHub CLI to create a new repository:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
gh repo create &amp;lt;repository-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Replace  with your desired repo name. You’ll be prompted to select:&lt;/p&gt;

&lt;p&gt;Visibility: Public or Private&lt;br&gt;
Location: In the current directory or as a blank repo&lt;br&gt;
For example, to create a public repository in your current folder, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
gh repo create my-awesome-project --public
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Stage and Commit Your Files
Stage all files for commit:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
git add . 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create your first commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
git commit -m "Initial commit"  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Push Your Code to GitHub
Push your local code to the newly created remote repository:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
git branch -M main  
git push -u origin main  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Verify Your Repository&lt;br&gt;
Head over to GitHub and check your profile or organization to see your new repository live!&lt;/p&gt;

&lt;p&gt;💡 Bonus Tips&lt;br&gt;
To create repositories for a specific GitHub organization, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
gh repo create &amp;lt;repository-name&amp;gt; --org &amp;lt;organization-name&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use gh repo view  to quickly view repository details from your terminal.&lt;/p&gt;

&lt;p&gt;Automate your workflow by combining these steps into a shell script.&lt;/p&gt;

&lt;p&gt;🚀 Conclusion&lt;br&gt;
Creating a GitHub repository from your terminal is quick, efficient, and keeps you in your flow. Tools like the GitHub CLI make managing repositories a breeze. Whether you’re starting a new project or migrating an existing one, this method saves time and keeps things simple.&lt;/p&gt;

&lt;p&gt;Do you have other tips for managing GitHub repositories? Let me know in the comments below!&lt;/p&gt;

&lt;p&gt;Happy coding! 🎉&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>git</category>
      <category>gitlab</category>
    </item>
  </channel>
</rss>
