Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Matzner
12,651 Pointsusing git to change github repository
quick question. there is only one thing that I'm trying to accomplish which is to add more files to my github.com repository through the terminal using git. I have been unsuccessful numerous times so far. (yes I am new and have 0 background/experience)
I have .jpg files on my desktop. I want to add those to my repository.
my repository is built from a file folder on my desktop.
I manually added my .jpg files to the file folder repository
cd the file folder
git add all of the jpeg files
git commit -m "adding pics"
git push -u origin master
I have received multiple error messages. Like I said my skill set is extremely poor. What would be the best way to add files from my desktop to my github repository using git in terminal. thanks.
4 Answers
Kevin Korte
28,149 PointsWe'll have to get more specific to help. First thing to do is to cd into the same directory that you root is (also where you should have initially done the git init
).
From the directory root, type git status
and let me know what it says.
Kevin Korte
28,149 Pointsso if you type git add -A
and that git status
again, does it show all of those files as tracked?
Michael Matzner
12,651 Pointsno its just blank. nothing comes up after those commands.
Kevin Korte
28,149 Pointsare you using a capital A for the add? git add -A
not git add -a
?
Michael Matzner
12,651 Pointsyeah i used capital A that was my mistake. this is what shows up.
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: ph1.jpg
deleted: ph2.jpg
deleted: ph3.jpg
deleted: ph5.jpg
deleted: ph6.jpg
deleted: ph7.jpg
deleted: ph8.jpg
deleted: ph9.jpg
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: posh/ty6 (1 of 1).jpg
deleted: posh/ty6 (1 of 16).jpg
deleted: posh/ty6 (10 of 16).jpg
deleted: posh/ty6 (11 of 16).jpg
deleted: posh/ty6 (12 of 16).jpg
deleted: posh/ty6 (13 of 16).jpg
deleted: posh/ty6 (14 of 16).jpg
deleted: posh/ty6 (16 of 16).jpg
deleted: posh/ty6 (2 of 16).jpg
deleted: posh/ty6 (3 of 16).jpg
deleted: posh/ty6 (4 of 16).jpg
deleted: posh/ty6 (5 of 16).jpg
deleted: posh/ty6 (6 of 16).jpg
deleted: posh/ty6 (7 of 16).jpg
deleted: posh/ty6 (8 of 16).jpg
deleted: posh/ty6 (9 of 16).jpg
modified: ty6 (1 of 1).jpg
modified: ty6 (1 of 16).jpg
modified: ty6 (10 of 16).jpg
modified: ty6 (11 of 16).jpg
modified: ty6 (12 of 16).jpg
modified: ty6 (13 of 16).jpg
modified: ty6 (14 of 16).jpg
modified: ty6 (16 of 16).jpg
modified: ty6 (2 of 16).jpg
modified: ty6 (3 of 16).jpg
modified: ty6 (4 of 16).jpg
modified: ty6 (5 of 16).jpg
modified: ty6 (6 of 16).jpg
modified: ty6 (7 of 16).jpg
modified: ty6 (8 of 16).jpg
modified: ty6 (9 of 16).jpg
William Li
Courses Plus Student 26,868 PointsAfter git add -A
, you also need to commit your tracked changes with
git commit -m 'message'
before pushing the repo to Github.
Michael Matzner
12,651 PointsMichael Matzner
12,651 PointsOn branch master# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## new file: Desktop/about.html# new file: Desktop/images.jpg# new file: Desktop/imgres.png# new file: Desktop/index.html# new file: Desktop/main1.css# new file: Desktop/ph1.jpg
new file: Desktop/ph2.jpg
new file: Desktop/ph3.jpg
new file: Desktop/ph4.jpg
new file: Desktop/ph5.jpg
new file: Desktop/ph6.jpg
new file: Desktop/ph7.jpg
new file: Desktop/ph8.jpg
new file: Desktop/ph9.jpg
new file: Desktop/photog.html
new file: Desktop/poshhome_1.jpg
new file: Desktop/responsive1.css
new file: Desktop/style.js
plus pretty much every other thing on my desktop but they are listed under the untracked files.