Github help posting issue

In a previous comment, I seem to remember that you have loaded git bash. You now need to add git bash to vs code terminal. Try this tutorial How to integrate Git Bash with Visual Studio Code? - GeeksforGeeks
( You might need to improvise a little as it seems like steps are not exactly right about the copy and paste and finding the path to git bash ) Alternatively see visual studio code - How to Add Git Bash to VsCode - Stack Overflow.
That should make git bash available in the dropdown for shell chooser. Once the terminal is using git bash the touch command will function properly. The command is not working now because your shell in the terminal is set to Powershell.
BTW, you are asking all the right questions, you are going the right way! Keep up the good work.

1 Like

Thank you. I feel empowered

When i run cd my_project this is what I get
poste3@pc MINGW32 ~/Desktop/development folder/Projects/Helloworld (main)
$ cd HELLOWORLD
bash: cd: HELLOWORLD: No such file or directory

I created a folder called HELLOWORLD with a html and a css file inside

so far this is what i have

poste3@pc MINGW32 ~/Desktop/development folder/Projects/Helloworld (main)
$ cd my_project
bash: cd: my_project: No such file or directory

poste3@pc MINGW32 ~/Desktop/development folder/Projects/Helloworld (main)
$ cd tribute.html
bash: cd: tribute.html: Not a directory

poste3@pc MINGW32 ~/Desktop/development folder/Projects/Helloworld (main)
$ cd HELLOWORLD
bash: cd: HELLOWORLD: No such file or directory

poste3@pc MINGW32 ~/Desktop/development folder/Projects/Helloworld (main)
$ cd U
bash: cd: U: No such file or directory

poste3@pc MINGW32 ~/Desktop/development folder/Projects/Helloworld (main)
$ cd

poste3@pc MINGW32 ~ (main)
$ git init
Reinitialized existing Git repository in C:/Users/poste3/.git/

poste3@pc MINGW32 ~ (main)
$ touch .gitignore readme.md LICENSE

poste3@pc MINGW32 ~ (main)
$ git add – all
fatal: pathspec ‘all’ did not match any files

poste3@pc MINGW32 ~ (main)
$ git add tribute.css
fatal: pathspec ‘tribute.css’ did not match any files

poste3@pc MINGW32 ~ (main)
$ git add – tribute.css
fatal: pathspec ‘tribute.css’ did not match any files

poste3@pc MINGW32 ~ (main)
$

In order:

  • there isn’t a directory called “my_project” in the directory Helloworld
  • there is a file called “tribute.html” but the “change directory” command changes directories, and that’s a file
  • there isn’t a directory called “HELLOWORLD” in the directory Helloworld
  • there isn’t a directory called “U” in the directory Helloworld
  • just running change directory without specifying which directory you want to change puts you in your home directory (this is bash specific; for example Windows cd command just prints the current directory name).
  • git init initialises a git repo, ie it creates a folder called .git which then holds information about all files in a directory and the changes you make to them. You’ve done this in your home directory which is an extremely bad idea: you now have a git repository that’s set up to track most of your stuff on your computer. You absolutely do not want this, so you need to find the .git folder in your home directory and delete it.
  • git add – all is, thankfully, incorrect syntax. It should be git add --all, but again, you absolutely do not want to add every file on your computer, so it is good that you didn’t get this right. You are in the wrong directory: it tells you what the directory is right there, you need to take notice of it.
  • There is no file called “tribute.css” in your home directory

directory === folder, if there is any confusion with what I’ve written above.

This one is serious.

@UzaifaJamina I am sorry. The commands I posted is an example of what I run on my computer.

$ touch .gitignore readme.md LICENSE

We have different operating systems so the commands are slightly different. I am guessing that you are using Windows 10? I am using a Linux distribution.

Notice in the command prompt MINGW32, which means running the Git Bash shell (on Windows 10). I tested the aforementioned command and it works as expected in Git Bash.

1 Like

Try ls -al to list all files including hidden files and directories in your current directory, which will also give you a hint about the spelling and capitalization of the files. Try pwd to print your working directory path, that way you will know where your commands will be running in the file system. The command cd .. will move up one directory, and cd ../.. up two directories. From my bookmarks here is a nice reference Linux Tutorial - 2. Master File System Navigation

1 Like

Looks like i will need to get a different operating system

You do not need a new operating system. You can use Windows, Mac OS, or Linux to post to Github and for programming in general.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.