Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding files to a GitHub repository

Tags:

git

github

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.

like image 516
user382738 Avatar asked Sep 26 '11 13:09

user382738


People also ask

How do I add all files to my repository?

To add and commit files to a Git repositoryEnter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed.


1 Answers

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:

Create new File

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 name yournewfile.txt.

d

like image 92
VonC Avatar answered Oct 16 '22 07:10

VonC