Follow these steps to turn a folder into a git repository.
-
In the command line, navigate to the folder you want to make a git repo.
-
Run
git init
. This starts or initializes an empty Git repo
To get a view of how this works under the hood, run ls -a
. There should be a .git
folder listed.
Running cd .git
will show us what's inside. All the information and settings Git needs to run are inside of this .git
folder.
Without .git
, Git won't track our project. If we don't want Git to track our project anymore, just delete the .git
folder using this command: rm -rm .git/
.
The point of using Git is to be able to sync up our local repo with a remote repo. We need a service like Github for that. The first step to doing this is creating a repo on Github.
-
Log into your Github account, click the plus symbol in the top right hand corner and select "New Repository".
-
Give your repo a name. It's best practice to give it the same name as the folder you're trying to upload.
-
Give your repo a description.
-
Click the "Create Repository" button.
After creating the remote repo, you'll want to follow these steps to actually sync your local repo with your remote repo.