From 6a3dc6f229660b19a3a40634fab90ce2d6fb0f68 Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Sun, 4 Apr 2021 14:04:05 +0300 Subject: [PATCH] Add repository creation snippets --- snippets/clone-repo.md | 23 +++++++++++++++++++++++ snippets/create-repo.md | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 snippets/clone-repo.md create mode 100644 snippets/create-repo.md diff --git a/snippets/clone-repo.md b/snippets/clone-repo.md new file mode 100644 index 000000000..d04f51c8a --- /dev/null +++ b/snippets/clone-repo.md @@ -0,0 +1,23 @@ +--- +title: Clone a repository +tags: repository,remote,beginner +--- + +Clones an existing repository, creating a local copy of it. + +- Use `git clone ` to clone an existing repository from `` to a local directory. The directory's name will be based on the name of the cloned repository. +- Alternatively, use `git clone []` to clone the repository into the specified local ``. + +```sh +git clone [] +``` + +```sh +git clone https://github.com/30-seconds/30-seconds-of-code.git +# Clones the repository in a new directory named '30-seconds-of-code' +cd 30-seconds-of-code + +git clone https://github.com/30-seconds/30-seconds-of-code.git my-project +# Clones the repository in a new directory named 'my-project' +cd my-project +``` diff --git a/snippets/create-repo.md b/snippets/create-repo.md new file mode 100644 index 000000000..774e43cba --- /dev/null +++ b/snippets/create-repo.md @@ -0,0 +1,23 @@ +--- +title: Create a new repository +tags: repository,beginner +--- + +Initializes a new git repository, setting up all the configuration files needed by git. + +- Use `git init` to initialize an empty repository in the current directory. +- Alternatively, use `git init []` to initialize the repository in the specified ``. +- Note: Running `git init` in an existing repository is safe. +- Note: You only need to run `git init` once per repository. + +```sh +git init [] +``` + +```sh +cd ~/my_project +git init # Initializes a repo in ~/my_project + +cd ~ +git init my_project # Initializes a repo in ~/my_project +```