0

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.

enter image description here

enter image description here

2
  • Excellent edit. Shift command . will make files and folders with a . visible.
    – bmike
    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.
    – Pedro
    Jan 25, 2020 at 4:52

3 Answers 3

1

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.

0

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.

3
  • My folder is on the desktop as follows --> Desktop/Tools/Git/MyFolder/.git Jan 24, 2020 at 18:35
  • Aah. I’ll link to the command to show hidden files.
    – bmike
    Jan 24, 2020 at 18:48
  • I have tried using the shortcut of shift+cmmd+. , the .git folder just appears and disappears to get it back up. Jan 24, 2020 at 18:59
0

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

https://linuxhandbook.com/create-file-linux/

16
  • Visibility of hidden files is the issue here unless I’m missing something.
    – bmike
    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)
    – anki
    Jan 24, 2020 at 18:52
  • 1
    right now, there are two gits, one in ~/ and another in ~/Desktop/Tools/Git/Myfolder
    – anki
    Jan 24, 2020 at 18:56
  • okay maybe they want git status 's output to go to a txt file, instead of Terminal.
    – anki
    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 Jan 24, 2020 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .