15

I'm following a tutorial to create a remote Git repository, clone it locally, add a README.md file and then save and commit locally then push remotely.

I have followed word for word a few times but when I get to "commit staged changes" every time it says:

Git: Failed to execute git

This is all using Visual Studio Code.

I'm not sure where to go from here and have no idea how to fix this.

This is just after I've pressed "commit":

Just after I've pressed commit

13
  • 6
    It sounds like either a) you never did the git init step to create a new local repository, or b) you did do git init, but you are trying to execute a Git command from outside the Git project folder. Please check for both of these possibilities. Commented Jul 20, 2018 at 5:04
  • 1
    I wouldn't have thought I did the git init as I have no idea what it is haha how would I do that? Sorry extremely new to this Commented Jul 20, 2018 at 5:07
  • 1
    I take back what I said, you should have already cloned a repo from GitHub. After you typed git clone <URL>, did it work? What did git status tell you from the same location? Commented Jul 20, 2018 at 5:09
  • 1
    Yeah I cloned it, and it worked, it has come up and created a folder in my computer. It let me add the file and then it lets me stage it but from there just won't commit. The file is in the folder on my computer aswell and i open it in notebook and it says what i put in it. But because it failed to commit it wont let me push to github as well. Commented Jul 20, 2018 at 5:14
  • 1
    Edit your question and show us the exact Git commands you used. It sounds now like the problem was with not committing, and then the push failed. Commented Jul 20, 2018 at 5:15

2 Answers 2

1

You need to initialize a Git repo for your project. To do this:

Inside of your Visual Studio Code Project, press Ctrl + `.

A terminal window will show up!

Enter: git init

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

Comments

1

After installing Git you need to set your name and email address so git can set the author of a commit.

git config --global user.name "John Doe"
git config --global user.email [email protected]

If you want to configure them for just that one repo, leave out the --global flag

Rel: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.