Adding files to a GitHub repository
How do I add files to my GitHub repository? I'm using Windows and all my project files are in one folder and I just need to upload it to my repo.
The general idea is to add, commit and push your files to the GitHub repo.
First you need to clone your GitHub repo.
Then, you would git add all the files from your other folder: one trick is to specify an alternate working tree when git add'ing your files.
git --work-tree=yourSrcFolder add .
(done from the root directory of your cloned Git repo, then git commit -m "a msg"
, and git push origin master
)
That way, you keep separate your initial source folder, from your Git working tree.
Note that since early December 2012, you can create new files directly from GitHub:
ProTip™: You can pre-fill the filename field using just the URL.
Typing?filename=yournewfile.txt
at the end of the URL will pre-fill the filename field with the nameyournewfile.txt
.
You can use Git GUI on Windows, see instructions:
- Open the Git Gui (After installing the Git on your computer).
- Clone your repository to your local hard drive:
- After cloning, GUI opens, choose: "Rescan" for changes that you made:
- You will notice the scanned files:
- Click on "Stage Changed":
- Approve and click "Commit":
- Click on "Push":
- Click on "Push":
- Wait for the files to upload to git:
Open github app. Then, add the Folder of files into the github repo file onto your computer (You WILL need to copy the repo onto your computer. Most repo files are located in the following directory: C:\Users\USERNAME\Documents\GitHub\REPONAME) Then, in the github app, check our your repo. You can easily commit from there.