Lauch Git CMD
Step 1: Redirect to the working directory
cd path/to/your/project
Step 2: Initialize the directory as a Git repository
Step 3 : Add Remote (create repo on git first)
git remote add origin https://github.com/your_github_repo.git
git init
Step 3 : Add Remote (create repo on git first)
git remote add origin https://github.com/your_github_repo.git
Step 4 : Add file
- All file : git add .
- Select file : git add file1.txt file2.txt
Step 5: Commit
git commit -m "Initial commit"Step 6 Push
First push: git push -u origin main
subsequent pushes : git pushAdditional
Before pushing, if you fail in step 6 you can try: git branch -M main to rename the current branch to main
Set Set Upstream Branch git push --set-upstream origin branch-name
Replace branch-name with your branch name
Check Status: git status
Switch to branch: git checkout branch-name
Check remote : git remote -v
Option 1:
+ Change remote URL: git remote set-url origin [URL]
Option 2:+ Change remote URL: git remote set-url origin [URL]
+ Remove and add: git remote remove origin -> git remote add origin [URL]
Option 3: + Use diff name: git remote add [new-remote-name] [URL]

Post a Comment