What to do after cloning a repo from git

I'm just a git starter , basically I cloned the git repository, and now I wanted to commit the changes that I made to the file. when I run the git commit command, it says not a git repository ,

So, as a starter in git, I just wanted to ask if I need to run this command first - git init , and then git commit ? Or are there a few more steps in between to fix the file?

I need to commit files to Bitbucket.

Screenshot -

enter image description here

+6
source share
2 answers

As jeremyharris, a git documentation site and especially an online book , said, you can speed up the basics.

A few quick notes that may lead you to your original problem.

Command

git clone used to pull a copy (clone) from an existing git repository. By default, it creates a folder in the folder in which you execute it, with the .git folder. The created cloning folder is your working copy, and the .git folder is your local copy of the repository.

git clone is different from most other git commands. All (or most?) Of other git commands require that the command be executed in the working copy folder created by the clone. (The base repositories are slightly different, as they do not have working copies, but this should not apply here.) So, after execution:

 $ git clone <remote repo> <repo name> 

make:

 $ cd <repo name> 

to enter the working copy before executing any other commands. Executing commands outside the working folder will result in a not a git repository message.

After making changes to the file, git add <filename> adds it to the index (marked to indicate readiness for commit), and git commit -m '<commit message>' then commits the changes.

+7
source

First you need to add the change, use git add .

You can also check the status before adding using git status

EDIT

Just saw the error comments. Yes, that's right. I neglect this.

Your problem is that you need to cd git folder first.

After that, you still need to add as my answer above.

+3
source

All Articles