6  What is GitHub

GitHub is a web-based platform for version control and collaboration, using Git as its core technology. It provides tools to manage Git repositories, enabling developers to work together on projects more efficiently.

6.0.1 Github accounts

Public versus private

Public repositories are searchable by anyone and can be directly scraped and copied. Never put sensitive data or scripts in a public repository.

You can create a free account on Github, which will allow to create unlimited public repositories. There are also paid versions of Github account where your create privite repositories. Additionally, you can join Github Organizations. PATH has a Github Organization call PATH-Global-Health, you can reach out to the PATH team to git added to the Organization.

6.0.2 Key Features

  1. Repositories: Store your project files and track changes. Public repositories are open to everyone, while private repositories are restricted to specific users.
  2. Branching and Merging: Work on features or fixes in isolation using branches, then merge them into the main codebase once they’re ready.
  3. Pull Requests: Facilitate code reviews and discussions before integrating changes into the main branch. Pull requests help ensure code quality and foster collaboration.
  4. Issues and Project Management: Track bugs, enhancements, and tasks using GitHub Issues. Organize and prioritize work with integrated project boards and milestones.
  5. Continuous Integration/Continuous Deployment (CI/CD): Automate testing and deployment workflows using GitHub Actions, ensuring code changes are tested and deployed seamlessly.

6.0.3 Getting Started

  1. Sign Up: Create an account on GitHub.

  2. Create a Repository: Start a new project by creating a repository.

  3. Clone the Repository: Clone the repository to your local machine using Git:

    git clone https://github.com/your-username/your-repository.git
  4. Make Changes and Push: Add, commit, and push changes to the repository:

    git add .
    git commit -m "Your commit message"
    git push origin main
  5. Collaborate: Use pull requests and issues to collaborate with others on your project.

By leveraging GitHub, you can enhance your workflow, improve collaboration, and manage your projects more effectively.

6.1 Using Git and and your Github account

Once you have Git installed and a Github account, there a few different ways you can use both on your computer: 1. Directly in the Terminal. 2. Using a graphical user interface program such as Github Desktop. 3. Using RStudio (covered in the next section).

6.1.1 GitHub Desktop

GitHub Desktop is a graphical user interface (GUI) application that makes it easier to interact with GitHub repositories without using the command line. It simplifies the workflow for managing code changes, committing, branching, and collaborating with others.

6.1.1.1 Getting Started

  1. Download and Install: Download GitHub Desktop from the official website and install it on your computer.
  2. Sign In: Launch GitHub Desktop and sign in with your GitHub account.
  3. Clone a Repository: Clone an existing repository by selecting “File” > “Clone Repository” and entering the repository URL or selecting it from your GitHub account.
  4. Create a New Repository: Create a new repository by selecting “File” > “New Repository” and following the prompts.
  5. Commit Changes: Make changes to your files, then use the interface to stage, commit, and push changes to the remote repository.
  6. Branch and Merge: Create and switch branches to work on new features or fixes. Use the merge tool to combine changes from different branches.

By using GitHub Desktop, you can manage your Git repositories more efficiently, especially if you prefer a graphical interface over the command line.