Working with Git
Now that you’ve set up Git locally and learned about some of the key concepts of Git, let’s dive into some hands-on tasks to get started and work with a Git repository.
Starting with a Git repository
There are two ways to start with a Git repository:
- Initializing a repository in a local non-Git directory
- Cloning a remote Git repository to a local directory
To clone an existing repository into a directory, create and change to the target directory, and then use the clone
Git command, as shown in the following command:
git clone https://github.com/markjprice/tools-skills-net8
To initialize a repository in a local non-Git directory, change to the directory, and then initialize a Git repository in that directory, as shown in the following command:
git init
The init
Git command creates a new hidden subdirectory named .git
that contains the needed Git repository files, as shown in the following output: