Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create git repository after project creation

I know there's an option to make a local repository for your project when you first create it, but is there an option create a repository after you've created your project?

like image 829
esqew Avatar asked Jun 16 '11 04:06

esqew


People also ask

Should I create a new repository for every project?

A new repo should only be created for a new project. For instance, if you are working on a 2 different e-commerce sites, don't put them in the same repo unless they have to work together.

How do I convert a project to Git?

git init Existing Folder For an existing project to become a Git repository, navigate into the targeted root directory. Then, run git init . Or, you can create a new repository in a directory in your current path. Use git init <directory> and specify which directory to turn into a Git repository.

How do I create a new repository from an existing branch?

The steps to follow in order to push new Git branches to remote repos such as GitHub, GitLab or Bitbucket are as follows: Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch.


2 Answers

Sure, just run the following command in your project directory:

git init

This will create the .git directory containing an empty repository. Then, add and commit your files.

like image 165
Greg Hewgill Avatar answered Oct 14 '22 07:10

Greg Hewgill


In the command prompt, make sure you're in the desired directory and perform a git init and you will have created an empty repository.

You can then proceed to add the files and directories to the repository by doing

git add <filename1> <filename2> ...

or you can select whole directories and use * to act as a wild card of sorts.

git add ./*

If you have any more questions check out these pages:

  • http://gitref.org/creating/
  • http://gitref.org/basic/#add

Hope this helps.

like image 4
elnino07 Avatar answered Oct 14 '22 08:10

elnino07