How to add exsiting project to git bare repository?

I am trying to setup git for automatic deployment. Here is what I am doing..

  1. I have created one empty bare repository on my repos server which hosted on
  2. Then in eclipse using EGit I have clone newly created bare repository.
  3. On my local machine I have one php project.
  4. Now I want to create 3 branches development, staging, production and want to add my project to development branch.

Maybe I am doing something wrong or missed something to setup. Can anyone please guide me for git setup?

  • Storing Configuration File
  • Debugging Azure functions in Visual Studio
  • Scheduled Azure WebJob deployed via Git results in On Demand Job
  • Triggering Jenkins to run application tests when GitHub PR is created
  • How to upload an APK from Jenkins/Hudson to Play Store?
  • Using SaltStack, How to Communicate with External Build Tool
  • All help would be appreciated.

  • How to commit added files only in Eclipse?
  • Dummy questions about setting up git on amazon cloud ec2
  • invalid username/password in egit when pushing changes to googlecode
  • embed version details in android APK
  • Eclipse not showing project files with git provider
  • Eclipse 4.6.1 JGit/EGit lo longer authenticating after upgrade
  • 3 Solutions collect form web for “How to add exsiting project to git bare repository?”

    To create the 3 branches, you can do the following (using whatever names you prefer) from the git command line:

    git checkout -b prod
    git checkout -b stage
    git checkout -b dev

    To add your project to the dev branch, copy your project files into the git working directory on your filesystem – this will be the directory that contains the ‘.git’ directory (i.e. not the ‘.git’ directory itself).

    Then from the command line run:

    git status

    which should give you a list of the files that you copied – they will be under the heading ‘Untracked files:’.

    Now run the following commands to add them to the dev branch (replacing “MyCommitMessage” with an appropriate commit message):

    git add .
    git commit -m "MyCommitMessage"

    At this point you can use

    git push --all

    to synchronise the remote bare repository with what you have locally.

    Since you have cloned from the hosted repository, you should have a git ‘remote’ configured called ‘origin’, which refers to your hosted repository.

    When you work and commit on a local branch (e.g. master) you can push that to a branch on the other repository with `git push origin :’

    git push origin master:development

    This assuming you have a git command line client available. You should be able to do the same thing with your graphical client, the main concept is that you push a branch with a certain name to a branch with a certain name on the other side.

    I’m not sure how comfortable you are with git command line, but since it’s how I use it, here it goes:

    1. instead of cloning your remote repo, go to your code folder and create a new local repo

      git init

    2. commit something to your local master branch to proper init it

      echo "first commit" > README.txt
      git add README.txt
      git commit -m "first commit"

    3. now you can create your three branchs

      git branch development
      git branch staging
      git branch production

    4. change to the development branch, and add all your code

      git checkout development
      git add .
      git commit -m "code commit"

    5. for last, add your remote repository and push your branchs

      git remote add origin <url_to_your_remote_repo>
      git push -u origin --all

    Git Baby is a git and github fan, let's start git clone.