Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

Git & GitHub - Repositories on GitHub

How to create and manage repositories on GitHub

Repositories are the core of GitHub, where your project's files, history, and collaboration take place. This guide covers how to create and manage repositories on GitHub, including setting up a new repository, configuring settings, and managing collaborators.

Key Points:

  • Creating a repository is the first step to hosting your project on GitHub.
  • Repositories can be public or private, depending on your project's needs.
  • Managing repository settings and collaborators is essential for effective project collaboration.

Creating a New Repository

Step 1: Go to the New Repository Page

Log in to your GitHub account and click on the "+" icon in the top-right corner of the page, then select "New repository" from the dropdown menu.

New Repository Button

Step 2: Fill Out Repository Details

Complete the form with the following information:

  • Repository Name: Choose a unique name for your repository.
  • Description (optional): Add a brief description of your project.
  • Visibility: Select whether the repository will be public or private.
  • Initialize with a README: Optionally, add a README file to describe your project.
  • Add .gitignore: Optionally, select a .gitignore template for your project type.
  • Add a license: Optionally, choose a license for your project.
New Repository Form

Step 3: Create the Repository

Click the "Create repository" button to finalize the creation of your new repository.

Managing Repository Settings

After creating your repository, you can configure its settings by navigating to the "Settings" tab within the repository. Key settings include:

  • Options: Change the repository name, description, and visibility.
  • Branches: Manage branch protection rules and set the default branch.
  • Webhooks: Configure webhooks for integrating with other services.
  • Collaborators: Add and manage collaborators with different access levels.
  • Secrets: Store sensitive information securely for use in GitHub Actions.
  • Deploy keys: Add SSH keys for deploying your project.
Repository Settings

Managing Collaborators

To collaborate with others on your repository, you can add collaborators with different levels of access:

  • Read: View the repository contents and issues.
  • Write: Read and write access, including pushing changes and managing issues.
  • Admin: Full access to the repository, including managing settings and collaborators.

# Add a collaborator
1. Go to the "Settings" tab of your repository.
2. Click on "Manage access" in the left sidebar.
3. Click on the "Invite a collaborator" button.
4. Enter the username or email of the collaborator and click "Add collaborator".
                

Importing an Existing Repository

If you have an existing repository that you want to import to GitHub, you can use the "Import repository" feature:

Import Repository

Summary

This guide covered how to create and manage repositories on GitHub, including setting up a new repository, configuring settings, and managing collaborators. Repositories are the core of GitHub, enabling you to host your projects, collaborate with others, and leverage GitHub's powerful features.