0

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:

My github account/

folder which houses it on my PC/

And the terminal with error

If anyone could offer advice for a newb, it would be greatly appreciated.

0

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you so much. So touch will create the file, add stages it and commit sends it to my repo?
yes. you are right.. touch will create an empty file for you , which later you can add contents into it by using any text editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.