To change a GitHub repository from public to private, follow these steps:
1. **Sign in to GitHub**: Ensure that you are logged in to your GitHub account.
2. **Navigate to the Repository**: Go to the GitHub repository that you want to change from public to private.
3. **Access Repository Settings**:
Click on the "Settings" tab, which is usually located in the right sidebar of the repository's page.
4. **General Settings**:
Scroll down the "Settings" page until you find the "Danger Zone" section.
In the "Danger Zone" section, you'll see an option labeled "Change repository visibility."
5. **Change Repository Visibility**:
Click the "Change repository visibility" link.
You'll be prompted to confirm your GitHub password or authenticate using two-factor authentication (2FA), if enabled.
6. **Set Repository to Private**:
After authentication, you'll see an option to set the repository to "Private."
Select the "Private" option.
7. **Confirm and Make Private**:
You may need to confirm your choice by entering your GitHub password again or using 2FA.
Follow the prompts to complete the process.
8. **Repository Visibility Changed**: Once the process is completed, the repository's visibility will be changed to private.
Please note the following important considerations when changing a repository from public to private:
Private repositories are not accessible to the public. Only users you invite as collaborators will have access.
If your repository was previously public, any forks of it by other users will also become private, and the users who forked it will lose access.
GitHub may provide a grace period for you to review and address any issues with changing visibility, such as ensuring collaborators have access.
Make sure to communicate with any collaborators or users who have been using or contributing to your repository when making this change, as it will restrict access to the repository.