GitHub Operations
Earlier, we created a repository locally on your computer. Now, we will push this repository to GitHub.
Create a new repository on GitHub
- Go to GitHub and log in.
- Click on the
+
icon in the top right corner and selectNew repository
. - Fill in the repository name, description, and choose whether it is public or private.
- Click on
Create repository
.
Push your repository to GitHub
- Go back to your terminal.
- Navigate to the directory where your repository is located.
- Run the following commands:
This will push your repository to GitHub. You can now view your repository on GitHub.
Pull changes from GitHub
If you are working on multiple machines or collaborating with others, you may need to pull changes from GitHub.
- Run the following command:
Bash | |
---|---|
This will pull the changes from GitHub to your local repository.
Push changes to GitHub
If you have made changes to your local repository and want to push them to GitHub, you can run the following command:
Bash | |
---|---|
This will push your changes to GitHub.
Clone a repository from GitHub
If you want to work on a repository that is hosted on GitHub, you can clone it to your local machine.
- Go to the repository on GitHub.
- Click on the
Code
button and copy the URL. - Run the following command:
Bash | |
---|---|
This will clone the repository to your local machine.