So I've been trying to create a text file using Git, I punched in the command "touch home.html", then I punched in the command git "add home.html", then I input "git status" and the file doesn't want to appear, I have relaunched the finder multiple times, nothing.
-
Excellent edit. Shift command . will make files and folders with a . visible.– bmike ♦Commented Jan 24, 2020 at 18:51
-
In Catalina I've frequently had newly created files not appear in the Finder. Even Safari downloads & new Pages or Numbers documents. If the creating application has a Show in Finder action (as Safari does) that will reveal it. Otherwise relaunching the Finder (which is a pain) makes them visible for me.– PedroCommented Jan 25, 2020 at 4:52
3 Answers
You're running git status
in the wrong repository (your home directory, ~
, i.e. /Users/adam
). You need to move into the repo that you want to act on, i.e. cd ~/Desktop/Tools/Git/MyFolder
, or a subdirectory of this, and then run git status
.
You've created the home.html
file in ~
.
You must have run git init
on your home directory or a parent of it, i.e. /Users/adam
, /Users
, or /
. The first is most likely, as the others would require use of sudo
. You can forget about / get rid of this repo by running rm -rf .git
within that directory.
I encourage you to learn the basics of Git by watching this video.
Here's a good video on Linux terminal basics as well. macOS isn't Linux, but it's Unix-based, just like Linux, so the principles are the same; the knowledge directly applies to macOS.
Why not use text edit to save a text file in that finder window.
Remember, Finder hides all files and folders with a . by default but you have an easy key shortcut to toggle that.
My thinking is you have nothing amiss in the graphical side, but you’ll want to troubleshoot a little using purely command line tools or purely graphical tools to avoid mixing idioms and troubleshooting steps.
For the next edit of your question, be sure to state where you are working. A folder on your desktop is ideal to avoid permissions errors if your git is elsewhere.
-
My folder is on the desktop as follows --> Desktop/Tools/Git/MyFolder/.git Commented Jan 24, 2020 at 18:35
-
-
I have tried using the shortcut of shift+cmmd+. , the .git folder just appears and disappears to get it back up. Commented Jan 24, 2020 at 18:59
The files to be tracked and .git
folder need to be in one folder.
Myfolder
|- .git
|- home.html
Use cd
to navigate. Use man cd
in case there is a doubt.
Examples:
>>> pwd
~/Desktop
>>> cd Tools/Git
>>> pwd
~/Desktop/Tools/Git
>>> cd Myfolder
>>> pwd
~/Desktop/Tools/Git/Myfolder
Now use touch
to make the HTML file and see if git can see it, and add it to tracking.
http://git.github.io/git-reference/basic/
File Management
then I input "git status" and the file doesn't want to appear,
Use >
operator to send the output of any command in Terminal to a txt or log file.
This command creates an empty text file named abc
on Desktop.
touch ~/Desktop/abc.txt
This command sends the output of git status
to a file status.txt
, you can change the location and filename.
>>> git status > ~/Desktop/status.txt
This command opens any txt/rtf/log file at the given path with TextEdit.app.
>>> open -a /Applications/TextEdit.app ~/Desktop/status.txt
-
Visibility of hidden files is the issue here unless I’m missing something.– bmike ♦Commented Jan 24, 2020 at 18:52
-
They made the html file in
~/
(see the bash prompt in Terminal) and the git setup is three folders deep. (see finder screenshot)– ankiCommented Jan 24, 2020 at 18:52 -
1right now, there are two gits, one in
~/
and another in~/Desktop/Tools/Git/Myfolder
– ankiCommented Jan 24, 2020 at 18:56 -
okay maybe they want
git status
's output to go to a txt file, instead of Terminal.– ankiCommented Jan 24, 2020 at 18:59 -
I want the txt file to appear, I just did the git status > ~/Desktop/status.txt, still nothing appears Commented Jan 24, 2020 at 19:05