Create Repository at GitHub or GitLab and copy the https address of the repo.
---
Open Git Command or Bash.
First get to the existing directory
```
> cd my/folder/
```
or Hold SHIFT, right click the folder you're in, then select Open command window here.
Now start a new git repository
```
> git init
```
---
Identify if the current elements on the directory are needed
or not and add them to the **.gitignore** file.
1. Create the text file gitignore.txt
2. Open it in a text editor and add your rules, then save and close
3. Hold SHIFT, right click the folder you're in, then select Open command window here
4. Then rename the file in the command line, with `ren gitignore.txt .gitignore`
---
When ready create the first commit on the server
```
> git add .
> git commit -m "my first commit"
```
---
if the remote repo was just created, it probably has no branch to push to
in this case; goto Github.com and create dummy.txt file which triggers the creation of the master branch.
you can delete the dummy.txt file once after the branch is created.
---
Now add the address the local repo to remote address
```config
[remote "origin"]
url = https://github.com/sarpay/NetCoreMVCStarter.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
```
---
Now push the files to the remote repo
```
> git push -u origin master
```
If you get cannot merge due to unrelated histories do;
```
> git pull --allow-unrelated-histories
```