Here's an easy-to-follow guide for using Git and GitHub:
Install GitHub CLI (gh):
Open your terminal.
Run the following command to install GitHub CLI:
sudo apt install gh
Authenticate with GitHub:
Run the command:
gh auth login
Follow the prompts to authenticate with GitHub.
Create a New Repository:
Run the command:
gh repo create <repo-name> --public
Initialize Git and Push to GitHub:
If you haven't initialized Git yet:
git init -b main git add . git commit -m "First commit"
To push an existing local repository to GitHub:
gh repo create # SELECT >> Push an existing local repository to GitHub
Alternatively, if you want to create a new repository from scratch:
gh repo create # SELECT >> Create a new repository on GitHub from scratch git add . git commit -m "Message"
Push your changes to GitHub:
git push -u -f origin main
Push Existing Project to an Existing Repository:
Initialize Git (if not already done):
git init -b main
Add files, commit changes, and set up the remote repository:
git add . git commit -m "hello my friend" git remote add origin <repository-url>
Push your changes to GitHub:
git push -u -f origin main
This guide should help you navigate through setting up and managing your projects with Git and GitHub. Let me know if you need further assistance!