GIT Practical Reference
GIT Practical Reference
Git Init and Clone
Creating a New Repository
By running git init
in an empty folder or an existing project folder you can initialize a Git repository. Navigate to the project's root directory in your terminal and run:
git init
This command creates a hidden .git
directory in your project folder, which contains all the necessary files and data to manage version control for your project.
Cloning an Existing Repository
If you have created a repository on Github, Gitlab, etc., you can create a local copy of the remote repository on your computer.
To clone a Git repository, use the git clone
command followed by the repository's URL:
git clone <repository_url>
Replace <repository_url>
with the actual URL of the repository on Github, Gitlab, etc., for example: https://github.com/username/example-repo.git
By default, Git clones the repository into a directory with the same name as the remote repository. If you want to specify a different directory name, you can do so after the URL:
git clone <repository_url> <directory_name>