I am new to Git (Git Bash) and GitHub and I have scoured the internet to try to find a solution to my issue so I thought I would ask here.
I have created a repo in my Github account and cloned it to what I believe is a directory. I am supposed to add a file named hello-world.py to the directory but I am getting an error of fatal : pathspec 'hello-world.py' did not match any files
Here are images:
folder which houses it on my PC/
If anyone could offer advice for a newb, it would be greatly appreciated.
CodePudding user response:
From the image you have attached, you are inside the root folder of your repository in your main branch. If you are trying to add a new file named hello_world.py to this repo, then please do as shown below:
To create a new file called hello_world.py
touch hello_world.py
Stage the newly created file hello_world.py
git add hello_world.py
Commit your change to the repo
git commit -m "Initial Commit"
If you want to make changes again to the hello_world.py, open the file in an editor and make the changes and then again follow the below steps:
git add hello_world.py
git commit -m "Added some changes"
You can learn how to use github from the below lab link: Github Learning Lab
Please note all this can be also done using UI application like GitHub Desktop, so you don't need to remember these commands