💻
How to Use Project Development Tools in a Remote C
  • How to Use Project Development Tools in a Remote Coding Team
  • Trello
    • Introduction to Trello
    • How to use Trello
      • What is Trello?
      • Starting up a Trello Board
      • Lists
      • Cards
  • Visual Studio Code
    • Introduction to Live Share in Visual Studio Code
    • How to use Live Share
      • How to Install
      • How to Use
      • Examples of Use Cases
  • Git & Github - Basics
    • Introduction to Git & GitHub
    • How To Use Git
      • Setting up Git
      • Creating GitHub Repositories
      • Managing Repository Access
      • Syncing with a Local Workspace
  • How to Manage a Codebase with Git
    • Introduction to Branching
    • How To Use Branches
      • What are Branches?
      • Working in Branches
      • Merging Branches
      • Best Practices For Branching
    • Git Codebase Management Cheat Sheet
  • Conclusion
  • Team Biography
  • References
Powered by GitBook
On this page
  • Creating an Empty Repo
  • Create a Repo from an Existing Project

Was this helpful?

Export as PDF
  1. Git & Github - Basics
  2. How To Use Git

Creating GitHub Repositories

PreviousSetting up GitNextManaging Repository Access

Last updated 4 years ago

Was this helpful?

GitHub repositories are remote directories that store files and their revision histories (see guide). With GitHub repositories, code collaborators can track changes made to source code, create different versions of code through branches, and manage access to code through repository visibility. GitHub repositories can be created through the GitHub GUI or through the command line with Git. This section will show how to create an empty remote GitHub repository using the GitHub GUI and how to initialize a remote GitHub repository from a local project.

Creating an Empty Repo

On the GitHub home page navigate to “+” at the top right of the page and click “new repository”

Set the owner of the repository from the drop down under the owner field and name the repository. The owner can be your own user account or an organization if your account is linked to any team/organization.

On the same page, set the repository access to public or private. This sets the read access for the repository. Public repositories can be read by anyone on the internet while private repositories can only be accessed by users or organizations you explicitly share the repository with. For both visibility modes, you choose who can commit to the repository.

(optional) Add a README file. README files are Markdown files that describe what your repository does and how to use it. Clicking the “Add a README file” box initializes your repository with an empty README file. The contents of README files will be displayed on the code section of the repository page.

(optional) Add a .gitignore file. The .gitignore file lists all the files that you don’t want to track the version history of. Under the “Add .gitignore” there is a drop down of templates for the .gitignore file for different industry practices or best practices for different languages.

(optional) Choose a license. You can initialize your project with a software license that defines what is fair use of your software. Under the “Choose a license” there is a drop down of software licenses that you can choose from.

Finally, click “create repository” at the bottom of the page.

Create a Repo from an Existing Project

$ cd [local_project] 
# initialize empty repository in .git directory
$ git init 
# Track all files in the project
$ git add --all 
$ git add LICENSE
# commit tracked files to the repository
$ git commit -m "first commit" 

These commands create a local Git repository and stage all the files in the workspace to be added to the empty remote workspace. To link this local workspace to the empty remote repository, you need an HTTPS link to your remote repository. To copy this https link:

  1. Click on the "code" section on the GitHub repository page

  2. Click on the “code” button

  3. Click on “HTTPS”

  4. Click the clipboard icon

Next, enter the following commands in a command shell:

$ cd [local_project]
#add a new remote
$ git remote add origin [your https link] 
#verify the new remote
$ git remote -v 
#push committed changes to repo
$ git push -u origin master 

These commands add a new remote for the empty repository and then push all the staged changes in the local Git repository to the remote repository.

To create a repository from an existing local project, first follow the steps in to create an empty remote repository. Next, enter the following commands in a command shell:

see

https://rubygarage.org/blog/most-basic-git-commands-with-examples
Creating an Empty Repo
this