Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Thursday, April 2, 2015

Adding an Existing Project to GitHub Repository

  The following steps to add the existing projects to add github repository

Step 1: Create New Repository in your github id.
            To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. Then to see the below image for creating new repository in your github






Here need to give the repository name, and need to choose the repository type i.e Public or private.

Step 2:  After create the repository please note down the repository Url i.e SSH or HTTPS
For example : git@github.com:MedicalManager/MedicalMaster.git

Step 3:  Then open the terminal for Mac, Linux users Or Open command prompt in Windows

Step 4:  Change the current directory to Project directory using cd command on Linux and Windows

Step 5:  After that initialize the git repository using the following command
              git init                                                                   
Step 6:  Add this files in local repository using the following command
             git add .                                                                                                                             
Adds the files in local repository and stages them for commit. To unstage a files using the following command
             git reset HEAD your-file                                        

Step 7:   Commit the stages file in your local repository
             git commit -m "Initial Commit"                             

Here the initial commit is a message so we can change it according to your project and your perspective
Note : To remove this commit and modify the files means use this command
              git reset --soft HEAD~1              and commit and add the modified files

Step 8: Setup the remote repository

     Here we want use the step 2 repository url . for example git@github.com:MedicalManager/MedicalMaster.git
             git remote add origin repository URL                    
Ex:  git remote add origin git@github.com:MedicalManager/MedicalMaster.git

Note : To verify the remote url use these command git remote -v

Step 9: Then Push the changes to remote repository
             git push origin master                   

No comments:

Post a Comment