# Populating a repo from local files

Using the web browser, create a new public repo called **Exercises**

<figure><img src="https://content.gitbook.com/content/C1tv1gDCmQOVxTprzQP4/blobs/NTCy953GXRXaZYrrfhjy/image.png" alt=""><figcaption></figcaption></figure>

At quick setup I can see the URL.

On your local PC, create a new folder called **Exercises** and copy some of your Python directories to it.

<figure><img src="https://content.gitbook.com/content/C1tv1gDCmQOVxTprzQP4/blobs/8KzJKPUWN0rgXOMxi3ae/image.png" alt=""><figcaption></figcaption></figure>

Open a terminal at this path.

Use **git status** to see if this is already a repo.

I ran the following commands in sequence to push these files to the GitHub repo. Use the URL to your own **Exercises** repo.

<figure><img src="https://content.gitbook.com/content/C1tv1gDCmQOVxTprzQP4/blobs/Y5mVqUcJuYWy9msRRxO7/image.png" alt=""><figcaption></figcaption></figure>

When I check back on GitHub, I can see that I have pushed my files and directories.

<figure><img src="https://content.gitbook.com/content/C1tv1gDCmQOVxTprzQP4/blobs/4poVA273KaJAurLji8pc/image.png" alt=""><figcaption></figcaption></figure>

Normally I would have to login with a username and password, but I had already done so.&#x20;

Note the command **git add \*** and identify what is does. Any directory which was empty did not copy up!

## Exercise

Below find a simple Linux shell script I wrote to add all the files in the local directory, commit and push them to the remote origin. The script assumes I have already set up the Git repo.

```
#!/bin/bash
# by: JOR
# Date: 11DEC18
# Function: Perform a commit
# Script: AddCommitPush.sh

clear
git status

echo '**************************************************'
echo "Performing an add for all files in this directory"
git add .
git status

echo '**************************************************'
echo 'Enter the commit message:'
read CommitMessage
git commit -m "$CommitMessage"
git status

echo '**************************************************'
echo 'Pushing to GITHUB repository'
git push -u origin master
echo '**************************************************'

echo 'Done!'

```

Firstly, understood what I did (for example, what do you suppose **git add .** means?). Rewrite this script for windows as a batch file.
