search
Search
Login
Math ML Join our weekly DS/ML newsletter
menu
menu search toc more_vert
Robocat
Guest 0reps
Thanks for the thanks!
close
Comments
Log in or sign up
Cancel
Post
account_circle
Profile
exit_to_app
Sign out
help Ask a question
Share on Twitter
search
keyboard_voice
close
Searching Tips
Search for a recipe:
"Creating a table in MySQL"
Search for an API documentation: "@append"
Search for code: "!dataframe"
Apply a tag filter: "#python"
Useful Shortcuts
/ to open search panel
Esc to close search panel
to navigate between search results
d to clear all current filters
Enter to expand content preview
icon_star
Doc Search
icon_star
Code Search Beta
SORRY NOTHING FOUND!
mic
Start speaking...
Voice search is only supported in Safari and Chrome.
Navigate to
A
A
brightness_medium
share
arrow_backShare
Twitter
Facebook

Creating a new repository

Software Development
chevron_right
Git
chevron_right
Cookbooks
schedule Jul 1, 2022
Last updated
local_offer
Tags

To create a new repository run the git init command in the directory which contains the files that you would like to track.

NOTE

A git repository is a directory having a .git directory serving as a virtual storage of your project. This enables you to track versions of your code and come back to them when needed.

From scratch

To create a new repository in the project2021 directory:

cd ~/project2021/
git init

Running the above command will create a new .git subdirectory under project2021 (current working directory).

To create a new directory called project2022 in the current directory and create a new project:

git init project2022

The above is equivalent to running mkdir project2022 && cd project2022 && git init

WARNING

It is not good practice to create a new repository inside another (i.e. nesting repositories) unless absolutely necessary, as you then need specify which .git folder to store changes in each time you make an update. As you can imagine, this quickly becomes very complicated to maintain.

Cloning an existing repository

To clone an existing repository we can use the git clone command with the following syntax:

Local repository

git clone <filepath> <newprojectname>

where:

  • <filepath> stands for the filepath of the local repository you would like to clone.

  • <newprojectname> stands for the name to give the cloned project in your home directory

Remote repository

git clone <URL> <newprojectname>

where:

  • <URL> stands for the URL of the repository you would like to clone

  • <newprojectname> stands for the name to give the cloned project in your home directory

mail
Join our newsletter for updates on new DS/ML comprehensive guides (spam-free)
robocat
Published by Arthur Yanagisawa
Edited by 0 others
Did you find this page useful?
thumb_up
thumb_down
Ask a question or leave a feedback...
thumb_up
0
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!