user1126212
user1126212

Reputation: 113

How to commit a folder to gitHub

I am new to GitHub, able to create a README textfile and commit that (from my local machine to github site) but now my problem is, i have one folder and i need to commit that folder to git hub, can any one of you help m e on this.

Upvotes: 9

Views: 34468

Answers (5)

RajasriK
RajasriK

Reputation: 1

Follow this steps to update your folder to GitHub:

Step 1: Navigate to your local repository(folder) that contains your code and initialize it

$ cd folderName (or) $ cd ~/FolderName 
$git init

Step 2: Add the folder to be a part of trackable files/folders list in GitRepository

$ git add FolderName/

step 3: Commit the folder(save your changes made) to GitRepository

$ git commit -m "Some Message" 

step 4 : connect GitHub to your local machine, Here you add a remote name origin to GitHub Repository. You can get this URL from "Clone or Download" link from your GitHub

$ git remote add origin URL

Step 5: Push the committed files/folders to HitHub repository

$ git push -u origin master

Refresh the GitHub repository and you could save the folder committed to respository. I hope this would be helpful!!

Upvotes: 0

Gaurav Tripathi
Gaurav Tripathi

Reputation: 1355

Its very simple. Follow some steps-

  1. Just click on the Upload files button.
  2. Now you can see a window where you can drag or upload the files.
  3. Just drag your required folder and it will upload in the repository (don't click on the choose your files button, it will upload your files only, not folder. )

Upvotes: 2

batMask
batMask

Reputation: 744

Try this :

git commit folder_path -m "your comment"

folder_path should full path, something like this ../../../folder_path

Upvotes: 0

sailor
sailor

Reputation: 8034

Try this :

git add myfolder
git commit -m "some message"
git push

Upvotes: 18

sascha
sascha

Reputation: 4690

git add FOLDERNAME

After that, you can do a normal commit + push as you did it with the README file.

Upvotes: 1

Related Questions