![]() |
VOOZH | about |
GitHub is a powerful platform for hosting and sharing code. Whether you’re working on a solo project or collaborating with others, adding code to a GitHub repository is essential. Here’s a step-by-step guide on how to add your code to a GitHub repository.
1. Log in to GitHub: Open your web browser and log in to your GitHub account.
2. Create a new repository:
1. Open your terminal: Open your command line interface (CLI) or terminal on your computer.
2. Navigate to your project directory: Use the cd command to navigate to the directory containing your project. For example:
cd path/to/your/project3. Initialize a Git repository:
git init1. Add files to the staging area: Use the git add command to add your files to the staging area. To add all files, run:
git add .2. Commit your changes: Use the git commit command to commit your changes. Add a meaningful commit message:
git commit -m "Initial commit"1. Add the remote repository:
https://github.com/yourusername/your-repository.git remote add origin https://github.com/yourusername/your-repository2. Verify the remote repository:
git remote -v1. Push your changes:
git push command to push your changes to the GitHub repository:git push -u origin mainmaster, use master instead of main.1. Check your repository: