Friday, February 27, 2015

How to upload your local JBoss Developer Studio Project into GitHub


In this tutorial, I will walk through the step by step instructions to deploy your locally created maven project into github also how to manage your git repository. There are plenty of good articles available in the internet regarding using git. Here In this article I am consolidating, those important steps needs set up remote git repository in github.com. For convenience to the readers and easy to understand the content, I attached the screen shot for some of the steps.
  1. First create your maven project in JBDS or eclipse. In this tutorial I am using JBDS-7.1.1
  2. Ope your terminal, navigate to the maven project folder






  1. Type the following command and enter (I assume , you already installed git in your machine)
    git init




  1. Create your git repository in github.com, do that you need to have your github account, if you already have one you can log into github and create your repository.
  2. Copy your git repository http origin url


  1. Go back to you terminal, type the following and enter
  2. Type following command and enter
    git add .


  1. Type the following command and enter
    git commit -m "initial commit"


  2. Type the following command and enter
    git push -u origin master
when you your new file or changes to remote repo, you have to provide your github used id and password








  1. If you accidentally push the wrong files or folder to github, don't worry, follow steps to fix it....
  2. Type git rm -r dir-name-to-remove and enter
    if you face any problem delete the files using the above command, use the following command to force the function
    git rm -rf dir-name-to-remove and enter
  3. Type git commit -m "Removed directory" and enter
  4. Type git push origin master and enter
  5. If you want to keep the folder or files locally and want to remove from the remote git repo use the following command
    git rm -r --cached dir-name-to-remove









  1. Type git commit -m "Removed directory" and enter




  1. Type git push origin master and enter














  1. If you want to permanently prevent those files added to remote git repo in future commit use .gitignore file.
  2. Create .gitignore
Git uses a file named .gitignore to exclude files that you never want to include in the repo, such as generated class files.
  1. In your local filesystem, navigate to the maven project folder.
  2. With your favorite text editor, create a new file in that folder named .gitignore.
  3. Add those file you want to block from commit in this new file and save it:
    for example,
      target/
      bin/
      .settings/
      .classpath
      .project
      *.zip
      *.log