A private repository on GitHub is a storage space for your code that is only visible to you and the specific people you invite to collaborate.
1. How to Create a Private Repository
Creating a private repository is straightforward through the GitHub web interface:
Log in to your GitHub account.
Click the + icon in the upper-right corner and select New repository.
Repository name: Give your project a name.
Visibility: Select the Private radio button.
3 Initialize: (Optional) Choose to add a README,
.gitignore, or license.4 Click Create repository.
2. How to Clone into Git on Windows
Cloning a private repository requires authentication because Git needs to prove you have permission to access the files.
Step A: Get the Repository URL
On your repository's main page, click the green Code button.
Copy the URL under the HTTPS tab (e.g.,
https://github.com/YourUsername/YourRepo.git).
Step B: Clone using Git Bash
Open Git Bash (installed with Git for Windows).
6 Navigate to the folder where you want the project:
cd Desktop/my-projects.Run the clone command:
Bashgit clone https://github.com/YourUsername/YourRepo.gitThe Authentication Prompt:
Git Credential Manager: A window will likely pop up asking you to sign in via your browser. This is the easiest method.
Personal Access Token (PAT): If prompted for a password in the terminal, GitHub no longer accepts your account password. You must use a
.Personal Access Token
Alternative: Using SSH
If you prefer not to type passwords, you can set up an SSH Key.
Generate a key in Git Bash:
ssh-keygen -t ed25519 -C "your_email@example.com".7 Add the public key (found in
~/.ssh/id_ed25519.pub) to your GitHub Settings > SSH and GPG keys.Clone using the SSH URL:
git clone git@github.com:YourUsername/YourRepo.git.
Comparison at a Glance
| Feature | Public Repository | Private Repository |
| Visibility | Anyone on the web | Only you and collaborators |
| Cloning | No login required (Read-only) | Authentication required |
| Best For | Open-source projects | Proprietary or personal work |
Since GitHub no longer accepts your standard account password for Git operations (like cloning or pushing code), you must use a Personal Access Token (PAT). Think of a PAT as a unique, secure password specifically for your development tools.
Here is the step-by-step guide to creating and using a PAT.
1. How to Generate a PAT (Classic)
Log in to your GitHub account.
Click your Profile Photo in the top-right corner and select Settings.
Scroll down the left sidebar and click Developer settings.
Click Personal access tokens and then select Tokens (classic).
Click the Generate new token dropdown and choose Generate new token (classic).
Note: Give your token a name (e.g., "Windows-Laptop-Clone").
Expiration: Choose how long the token stays valid (e.g., 30 or 90 days).
Select scopes: This is important! To clone private repositories, check the box for repo (Full control of private repositories).
Scroll to the bottom and click Generate token.
[!CAUTION]
Copy your token immediately. You will not be able to see it again once you leave the page. Store it in a password manager or a secure note.
2. How to Use the Token on Windows
When you run the git clone command in your terminal or Git Bash, a prompt will appear asking for your credentials.
Username: Enter your GitHub username.
Password: Do NOT enter your GitHub account password. Instead, paste the PAT you just generated.
The "Inline" Method (Faster)
You can also include the token directly in the clone command to skip the login prompt:
git clone https://YOUR_TOKEN_HERE@github.com/YourUsername/YourRepo.git
3. Saving the Token in Windows
If you don't want to paste the token every single time you push or pull code, you can save it in the Windows Credential Manager:
Open the Start Menu and search for Credential Manager.
Select Windows Credentials.
Look for
git:https://github.com.Click Edit and replace the existing password with your Personal Access Token.
Click Save.
Comparison: Password vs. Token
| Feature | Account Password | Personal Access Token (PAT) |
| Used for | Logging into GitHub.com | Command line (Git Bash/CMD) |
| Security | Full access to your account | Restricted to specific tasks (scopes) |
| Revocable | Must change entire password | Can delete one token without affecting others |
GitHubలో ప్రైవేట్ రిపోజిటరీ (Private Repository) అంటే ఏమిటి, దానిని ఎలా సృష్టించాలి మరియు విండోస్లో ఎలా క్లోన్ చేయాలో ఇక్కడ వివరంగా ఉంది:
1. ప్రైవేట్ రిపోజిటరీ అంటే ఏమిటి?
GitHubలో ప్రైవేట్ రిపోజిటరీ అనేది మీ కోడ్ను భద్రపరిచే ఒక రహస్య ప్రదేశం. ఇది కేవలం మీకు మరియు మీరు అనుమతి ఇచ్చిన సహచరులకు (Collaborators) మాత్రమే కనిపిస్తుంది.
పబ్లిక్ రిపోజిటరీ: ఇంటర్నెట్లో ఎవరైనా చూడవచ్చు.
ప్రైవేట్ రిపోజిటరీ: ఇది ఇంటర్నెట్లో ఇతరులకు కనిపించదు. మీ వ్యక్తిగత ప్రాజెక్ట్లు లేదా కంపెనీ కోడ్ కోసం దీనిని ఉపయోగిస్తారు.
2. ప్రైవేట్ రిపోజిటరీని సృష్టించడం ఎలా?
ముందుగా మీ GitHub అకౌంట్లోకి లాగిన్ అవ్వండి.
స్క్రీన్ పైన కుడివైపున ఉన్న + ఐకాన్పై క్లిక్ చేసి, New repositoryని ఎంచుకోండి.
Repository name: మీ ప్రాజెక్ట్కు ఒక పేరు ఇవ్వండి.
Visibility: ఇక్కడ తప్పనిసరిగా Private అనే ఆప్షన్ను సెలెక్ట్ చేయండి.
కింద ఉన్న Create repository బటన్పై క్లిక్ చేయండి.
3. Windowsలో దీనిని ఎలా క్లోన్ (Clone) చేయాలి?
ప్రైవేట్ రిపోజిటరీని మీ కంప్యూటర్లోకి డౌన్లోడ్ చేసుకోవడానికి (Clone చేయడానికి) GitHub మీకు అనుమతి ఉందో లేదో తనిఖీ చేస్తుంది (Authentication).
స్టెప్ A: రిపోజిటరీ URLని కాపీ చేయండి
మీ రిపోజిటరీ పేజీలో పైన ఉన్న పచ్చని రంగు Code బటన్పై క్లిక్ చేయండి.
HTTPS ట్యాబ్లో ఉన్న లింక్ను కాపీ చేయండి (ఉదాహరణకు:
https://github.com/Username/RepoName.git).
స్టెప్ B: Git Bash ఉపయోగించి క్లోన్ చేయండి
మీ Windows కంప్యూటర్లో Git Bash ఓపెన్ చేయండి.
మీరు కోడ్ను ఎక్కడ సేవ్ చేయాలనుకుంటున్నారో ఆ ఫోల్డర్కు వెళ్లండి:
cd Desktop/projects
ఇప్పుడు ఈ కింది కమాండ్ టైప్ చేయండి:
Bashgit clone https://github.com/YourUsername/YourRepo.gitAuthentication: ఒక విండో ఓపెన్ అవుతుంది. అక్కడ మీ GitHub యూజర్ నేమ్ మరియు పాస్వర్డ్తో (లేదా బ్రౌజర్ ద్వారా) లాగిన్ అవ్వమని అడుగుతుంది. ఒకసారి లాగిన్ అయితే, కోడ్ మీ కంప్యూటర్లోకి డౌన్లోడ్ అవుతుంది.
పోలిక (Comparison)
| ఫీచర్ | పబ్లిక్ (Public) | ప్రైవేట్ (Private) |
| ఎవరు చూడగలరు? | ఇంటర్నెట్లో ఎవరైనా | మీరు మరియు మీరు అనుమతించిన వారు |
| భద్రత | తక్కువ (కోడ్ అందరికీ కనిపిస్తుంది) | ఎక్కువ (కోడ్ రహస్యంగా ఉంటుంది) |
| క్లోనింగ్ | లాగిన్ లేకుండానే చేయవచ్చు | తప్పనిసరిగా లాగిన్ అవ్వాలి |
ముఖ్య గమనిక: ఒకవేళ Git Bash మీ పాస్వర్డ్ అడిగినప్పుడు మీ సాధారణ GitHub పాస్వర్డ్ పని చేయకపోతే, మీరు Personal Access Token (PAT) ఉపయోగించాల్సి ఉంటుంది.
GitHubలో పాస్వర్డ్లకు బదులుగా Personal Access Token (PAT) ఉపయోగించడం ఇప్పుడు తప్పనిసరి. మీరు మీ అకౌంట్ పాస్వర్డ్తో కోడ్ను క్లోన్ చేయడానికి ప్రయత్నిస్తే అది పని చేయదు.
PATని ఎలా క్రియేట్ చేయాలో మరియు ఎలా ఉపయోగించాలో ఇక్కడ దశల వారీగా ఉంది:
1. Personal Access Token (PAT) క్రియేట్ చేయడం ఎలా?
GitHub వెబ్సైట్లో లాగిన్ అవ్వండి.
కుడివైపు పైన ఉన్న మీ Profile Picture పై క్లిక్ చేసి, Settings లోకి వెళ్లండి.
ఎడమవైపు చివరన ఉన్న Developer settings పై క్లిక్ చేయండి.
ఇప్పుడు Personal access tokens ని క్లిక్ చేసి, దాని కింద ఉన్న Tokens (classic) ని ఎంచుకోండి.
Generate new token బటన్పై క్లిక్ చేసి, Generate new token (classic) ని సెలెక్ట్ చేయండి.
Note: ఈ టోకెన్ ఎందుకో గుర్తుండడానికి ఒక పేరు ఇవ్వండి (ఉదా: "MyLaptopToken").
Expiration: ఇది ఎన్ని రోజులు పని చేయాలో ఎంచుకోండి (ఉదా: 30 days లేదా 90 days).
Select scopes: ప్రైవేట్ రిపోజిటరీలను క్లోన్ చేయడానికి, ఖచ్చితంగా
repoఅనే బాక్స్ను టిక్ చేయండి.చివరగా కింద ఉన్న Generate token పై క్లిక్ చేయండి.
ముఖ్యమైన విషయం: టోకెన్ జనరేట్ అయిన తర్వాత ఒక పొడవైన కోడ్ కనిపిస్తుంది. దానిని వెంటనే కాపీ చేసి ఎక్కడైనా భద్రపరుచుకోండి. ఆ పేజీ నుండి బయటకు వస్తే మళ్ళీ ఆ కోడ్ మీకు కనిపించదు.
2. Windowsలో PATని ఎలా ఉపయోగించాలి?
మీరు git clone కమాండ్ ఇచ్చినప్పుడు యూజర్ నేమ్ మరియు పాస్వర్డ్ అడుగుతుంది:
Username: మీ GitHub యూజర్ నేమ్ ఇవ్వండి.
Password: మీ GitHub పాస్వర్డ్ ఇవ్వకండి. దానికి బదులుగా మీరు కాపీ చేసిన Personal Access Token (PAT) ని ఇక్కడ పేస్ట్ చేయండి.
ఒకవేళ డైరెక్ట్ కమాండ్తో చేయాలనుకుంటే (Easy Method):
URLలోనే టోకెన్ను ఈ విధంగా చేర్చవచ్చు:
git clone https://YOUR_PAT_TOKEN@github.com/YourUsername/YourRepo.git
(పైన ఉన్న YOUR_PAT_TOKEN స్థానంలో మీ టోకెన్ కోడ్ను ఉంచండి)
3. Windows Credential Manager (ఒక్కసారి సేవ్ చేస్తే చాలు)
మీరు ప్రతిసారీ టోకెన్ ఇవ్వడం కష్టంగా అనిపిస్తే, విండోస్లో ఇలా చేయండి:
Control Panel కి వెళ్లండి.
User Accounts > Credential Manager సెలెక్ట్ చేయండి.
Windows Credentials పై క్లిక్ చేయండి.
అక్కడ
git:https://github.comఅని ఉంటే దానిని ఎడిట్ చేసి, పాస్వర్డ్ ప్లేస్లో మీ PAT ని పేస్ట్ చేయండి.
గుర్తుంచుకోవలసినవి:
మీ PATని ఎవరికీ షేర్ చేయవద్దు (ఇది మీ పాస్వర్డ్ లాంటిదే).
ఒకవేళ టోకెన్ పోతే, మళ్ళీ కొత్త టోకెన్ క్రియేట్ చేసుకోవచ్చు.

