Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do after cloning repo from git

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

So being a starter in git i just wanted to ask that do i need to run this command first - git init and then git commit? Or in between these some more steps to follow to commit the file?

I need to commit files on Bitbucket.

Screenshot-

enter image description here

like image 846
Trialcoder Avatar asked Jan 15 '13 18:01

Trialcoder


People also ask

What do you do after cloning a repo?

Cloning a repository syncs it to your local machine. After you clone, you can add and edit files and then push and pull updates.

What happens after cloning?

What happens after the cloning reaction? Once the DNA fragment is cloned into a vector, you will need to characterize and validate each clone. Now that you have your clone in bacteria, you will need to recover the DNA from the cells.

What happens when you clone a git repository?

Cloning a repository pulls down a full copy of all the repository data that GitHub.com has at that point in time, including all versions of every file and folder for the project. You can push your changes to the remote repository on GitHub.com, or pull other people's changes from GitHub.com.

How do I run a cloned repository?

From your repository page on GitHub, click the green button labeled Clone or download, and in the “Clone with HTTPs” section, copy the URL for your repository. Next, on your local machine, open your bash shell and change your current working directory to the location where you would like to clone your repository.


2 Answers

As jeremyharris said, the git documentation site and especially the online book there will get you up to speed on the basics.

A few quick notes that might get you past your initial issue.

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

git clone is different than most other git commands. All (or most?) other git commands require the command to be executed within the working copy folder created by the clone. (Bare repositories are a bit different since they don't have working copies, but that shouldn't apply here.) So, after doing:

$ git clone <remote repo> <repo name> 

do:

$ cd <repo name>

to get into the working copy before executing any other commands. Executing commands outside of the working folder will get you the not a git repository message.

After making a change to a file, git add <filename> adds it to the index (marked to indicate ready to commit) and git commit -m '<commit message>' will then commit the changes.

like image 197
David Culp Avatar answered Oct 24 '22 03:10

David Culp


You need to add the change at first, use git add .

You can also check the status before adding, by using git status

EDIT

Just saw the comments about error. Yes that's correct. I neglect that.

Your problem is you need to cd the git folder at first.

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

like image 38
Billy Chan Avatar answered Oct 24 '22 05:10

Billy Chan