|6. GitHub वर Code Push करा
Chapter 6Git & GitHub~1 min read

GitHub वर Code Push करा

Remote Repository Basics

GitHub वर code push म्हणजे तुमचा local code cloud वर backup करणे. यासाठी GitHub वर repository बनवायची, local repo ला त्याच्याशी connect करायचं, आणि push करायचं.

SSH Key Setup (एकदाच करायचं)

SSH key generate करा

bash
# SSH key बनवा
ssh-keygen -t ed25519 -C "your@email.com"

# Public key copy करा
cat ~/.ssh/id_ed25519.pub

# GitHub Settings → SSH Keys → New SSH Key → paste करा

Remote Repository Connect करणे

Local repo ला GitHub शी connect करा

bash
# GitHub वर नवीन repository बनवा (github.com)

# Local repo मध्ये remote add करा
git remote add origin git@github.com:username/repo-name.git

# Remote बघा
git remote -v

# पहिल्यांदा push करा
git push -u origin main

# नंतर फक्त
git push

Clone, Pull, Fetch

Remote repository operations

bash
# GitHub वरून project download करा
git clone git@github.com:username/repo.git

# Remote मधील latest changes local मध्ये आणा
git pull origin main

# Changes fetch करा (merge न करता)
git fetch origin
📌

git pull = git fetch + git merge. Fetch फक्त changes download करतो, merge नाही. Pull दोन्ही करतो.

Key Points — लक्षात ठेवा

  • git remote add origin URL — remote connect करा
  • git push — local commits GitHub वर पाठवा
  • git pull — GitHub चे changes local मध्ये आणा
  • git clone URL — GitHub repo download करा
  • origin = default remote name
0/10 chapters पूर्ण