If we need to push an existing project/folder to Github. We can do it with out cloning the empty repository. First we need to create a repository in github. It is good if the name of the repository is same as the parent folder that contains the data to be push. After creating the repository we will get an url of that repository, For eg: https://github.com/user_name/repository_name
After this enter into the project folder and do the following steps.
After the first pull and and push you can do the git operations as usual. Here in the above command we are using remote add 'origin', besides 'origin' if you are using 'master' rr some other name.It will also work. But when we pull or push,The command will change, instead of origin we need to give the name that we provided at the time of remote add
After this enter into the project folder and do the following steps.
git init git remote add origin https://github.com/user_name/repository_name git add file_names git commit added_file_names git push origin master git pull origin master
After the first pull and and push you can do the git operations as usual. Here in the above command we are using remote add 'origin', besides 'origin' if you are using 'master' rr some other name.It will also work. But when we pull or push,The command will change, instead of origin we need to give the name that we provided at the time of remote add
No comments:
Post a Comment