🛠 how to upload a project to github
Useful Commands
git init
git add .
git add <file name>
git commit -m "Commit message"
git remote add origin https://github.com/your_username/your_project.git
git push -u origin main
git push
Steps
- Create a repository on GitHub:
- Log in to GitHub and create a new repository with a name and description.
- Set the visibility (public or private) and create the empty repository.
- Initialize Git in your project:
- Open a terminal and navigate to the project's root folder.
- Execute
git init
to initialize Git.
- Add files to the repository:
- Use
git add .
to add all pending changes to the staging area.
- You can use
git add <file name>
to add specific files.
- Commit the changes:
- Execute
git commit -m "Commit message"
with a descriptive message.
- Connect your local repository with GitHub:
- Add the remote GitHub address with
git remote add origin <GitHub repository address>
.
- Push the changes to GitHub:
- Use
git push -u origin main
to upload the changes to the "main" branch on GitHub.
- Verify on GitHub