Unrelated Git files

Unrelated Git files


I am not great at Git. I do not understand it. I am using the Git instructions to make a portfolio repo. I made one and pushed my index.html file. When I checked GitHub I had random files from my computer. I erased the repo and tried to start over. It keeps adding random files. How do I fix this? What does this mean?

Your branch is ahead of ‘origin/master’ by 1 commit.
(use “git push” to publish your local commits)
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)

modified:   Library/Caches/CloudKit/com.apple.Safari/6f95fd8e1f6c500d45050ef211612410ee8c4054/Records/Records.db
modified:   Library/Caches/CloudKit/com.apple.Safari/6f95fd8e1f6c500d45050ef211612410ee8c4054/Records/Records.db-shm
modified:   Library/Caches/CloudKit/com.apple.Safari/6f95fd8e1f6c500d45050ef211612410ee8c4054/Records/pcs.db-wal
modified:   Library/Caches/com.apple.parsecd/session.472
modified:   Library/Containers/com.microsoft.Word/Data/Library/Caches/Microsoft/uls/com.microsoft.Word/logs/Daphnie’s MacBook Pro-20170530-2005.log
modified:   Library/Cookies/HSTS.plist
modified:   Library/Group Containers/UBF8T346G9.Office/MicrosoftRegistrationDB.reg
modified:   Library/Safari/History.db-wal
modified:   Library/Safari/LastSession.plist
modified:   Library/Saved Application State/com.apple.Safari.savedState/data.data
modified:   Library/Saved Application State/com.apple.Safari.savedState/windows.plist
modified:   Library/Saved Application State/com.apple.Terminal.savedState/data.data
modified:   Library/Saved Application State/com.apple.Terminal.savedState/window_2.data
modified:   Library/Saved Application State/com.apple.Terminal.savedState/windows.plist
modified:   Library/com.apple.nsurlsessiond/E8C9768780A371F36651AB699D884E881706B377/2B464929B8F5FA869AA02198352C02468A441A46/tasks.plist
modified:   daphnied.github.io (untracked content)
modified:   freecodecamp (modified content)
modified:   ruby (untracked content)
modified:   ruby-challenges (untracked content)

Untracked files:
(use “git add …” to include in what will be committed)

Library/Saved Application State/com.apple.Safari.savedState/window_2.data

It took 2.93 seconds to enumerate untracked files. 'status -uno’
may speed it up, but you have to be careful not to forget to add
new files yourself (see ‘git help status’).
no changes added to commit (use “git add” and/or “git commit -a”)
Daphnies-MBP:~ daphniedonnell$ git add .
Daphnies-MBP:~ daphniedonnell$ git commit -m “initial commit”
[master a1511a0] initial commit
21 files changed, 37 insertions(+)
delete mode 100644 Library/Group Containers/UBF8T346G9.Office/lck257b5d264afbbb93
delete mode 100644 Library/Group Containers/UBF8T346G9.Office/lck82e50a35be3d2e17
delete mode 100644 Library/Group Containers/UBF8T346G9.Office/lckb42f6ce6157f02be
delete mode 100644 Library/Group Containers/UBF8T346G9.Office/lckc555ad95d02c5687
rewrite Library/Safari/LastSession.plist (98%)
create mode 100644 Library/Saved Application State/com.apple.Safari.savedState/window_2.data
rewrite Library/Saved Application State/com.apple.Safari.savedState/windows.plist (75%)
rewrite Library/Saved Application State/com.apple.Terminal.savedState/data.data (87%)
rewrite Library/Saved Application State/com.apple.Terminal.savedState/window_2.data (97%)
rewrite Library/com.apple.nsurlsessiond/E8C9768780A371F36651AB699D884E881706B377/2B464929B8F5FA869AA02198352C02468A441A46/tasks.plist (60%)
Daphnies-MBP:~ daphniedonnell$ git remote add origin git@github.com:daphnied/My-Portfolio.git
fatal: remote origin already exists.
Daphnies-MBP:~ daphniedonnell$ git push -u origin master
Enter passphrase for key ‘/Users/daphniedonnell/.ssh/id_rsa’:
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Daphnies-MBP:~ daphniedonnell$


Looks like you did a git init on the root directory of your Mac? Instead of your project subdirectory.

Erase the hidden .git subdirectory on the root of your Macintosh HD and make sure to change directory to your project directory before doing a git init.

Erase your remote repository too and start again from scratch.


I wonder if maybe you have run Git init in your home directory? rather than your project directory.

If not you might also need to create a .gitignore file - this is where you add files and dirs that you don’t want to commit.

I just found this doing a bit of a search of potentially useful links:



edit: oops sorry looks like @owel has you covered


Thank you both. Yes I was working from the root. I will work on the gitignore issue. I will start over tomorrow.



Check out this Git tool. It’s very easy to use, and works with github too.


That’s not an ideal practice.
If you initialize the root as a git repo, then every time you’ll add a file to the system you either have to remove it or ignore it in case you don’t want to make it public.

In general what I recommend (and what I do is), assuming this is my root file tree:

marmiz at MacBook-Pro in ~
$ ls
Applications  Desktop   Downloads  Library   [ other general mac stuff]

I create a directory of personal projects and inside there I create my various project folder that I will individually initialize as a git repo.

$ mkdir personal-projects
$ mkdir personal-projects/project1
$ mkdir personal-projects/project2

So that I’ll have:

marmiz at MacBook-Pro in ~
$ ls
 -[Other mac stuff]

Then I navigate into one of the project and git init that directory:

$ cd personal-projects/project1

marmiz at MacBook-Pro in ~personal-projects/project1
$ git init

I also recommend to configure your bash to always display the branch you are working on (assuming you are in a git repo) to avoid confusion.
I made my configuration myself but for an easy and quick start up I suggest this so that your terminal will display:

marmiz at MacBook-Pro in ~personal-projects/project1 (master)

Apologize if this long explanation is not what you were looking for.
Hope it helps regardless :slight_smile:


No this is all helpful. I didn’t know how to set up my folders.


Is it okay to put my projects folder on my desktop or documents folder?


Just put it on it’s own separate subdirectory… then git init inside that subdirectory

/My Documents/superDuperProject

cd superDuperProject

git init