git

🏠 Homepage 🏠 Syllabus of Day 2 ⬅️ Previous: 🔁 Opening a Pull Request (PR)

7. Adding Collaborators (Alternative to Forking)

What is a Collaborator?

A collaborator is someone who has been granted direct write access to a repository. Collaborators can push changes, create branches, and merge pull requests without needing to fork the repository.

When to Add Collaborators

How to Add Collaborators on GitHub

  1. Go to your repository on GitHub.
  2. Click on the Settings tab.
  3. In the left sidebar, click Collaborators & teams (or Manage access).
  4. Click Add people.
  5. Enter the GitHub username of the person you want to add and click Add.

Permissions Required

Cloning as a Collaborator

Once added as a collaborator, you can clone the repository and push changes directly:

git clone git@github.com:owner/repo-name.git
cd repo-name

Example Workflow for Collaborators

  1. Clone the repository:
    git clone git@github.com:owner/repo-name.git
    cd repo-name
    
  2. Create a new branch for your changes:
    git checkout -b feature/your-feature
    
  3. Make changes, commit, and push:
    git add .
    git commit -m "Describe your changes"
    git push origin feature/your-feature
    
  4. Open a pull request (recommended for code review).

Summary Table

Action Description/Command
Add collaborator Settings → Collaborators & teams → Add people
Clone repo git clone git@github.com:owner/repo-name.git
Create branch git checkout -b feature/your-feature
Push branch git push origin feature/your-feature

Tip:
Adding collaborators is best for trusted team members working on private or shared projects.

➡️Up Next: 🔀 Merging the PR into Main