Welcome to Week 3
details coming soon....
Cloning a public repository to your hard-drive
Using terminal with Git installed locally (on your computer)!
Here are the steps to pull a public repository from GitHub to your local hard drive:
- First, navigate to the main page of the repository on GitHub.com.
- Above the list of files, click on the Code button.
- Copy the URL for the repository.
- Open your terminal or Git Bash and navigate to the directory where you want to clone the repository.
- Type git clone followed by the URL you copied earlier.
For example, if you wanted to clone the my-repo repository from GitHub to your local hard drive, you would run the following command:
git clone https://github.com/your-username/my-repo.git
- Press Enter to create your local clone.
- This will create a new directory called my-repo in your current working directory, which will contain a copy of the repository.
Here are the steps to update your GitHub repository with a new pull:
- First, navigate to your local repository directory using the command line or terminal.
- Ensure that you are on the correct branch by running the command git branch. If you are not on the correct branch, switch to the correct branch using the command
git checkout <branch_name>
.
- Run the command
git pull
to fetch and merge the changes from the remote repository into your local repository. If you want to avoid adding a new merge commit, use git pull --rebase
instead.
- If there are any merge conflicts, resolve them manually by editing the affected files and then committing the changes using the command
git commit -m "Merge conflict resolution"
.
- Finally, push the changes to the remote repository using the command
git push
.