Add repository creation snippets

This commit is contained in:
Isabelle Viktoria Maciohsek
2021-04-04 14:04:05 +03:00
parent 40369f1604
commit 6a3dc6f229
2 changed files with 46 additions and 0 deletions

23
snippets/create-repo.md Normal file
View File

@ -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 [<directory>]` to initialize the repository in the specified `<directory>`.
- Note: Running `git init` in an existing repository is safe.
- Note: You only need to run `git init` once per repository.
```sh
git init [<directory>]
```
```sh
cd ~/my_project
git init # Initializes a repo in ~/my_project
cd ~
git init my_project # Initializes a repo in ~/my_project
```