Mountain View


Add local project to github

Posted On : 27-Jul-2018 [150]




Task 1 :

Make sure , you created repository on GitHub . While creating repository, do not initialize the new repository with README, license ( Strictly , don't check 'Initialize this repository with a README' while creating repository in GitHub )

Task 2 :

Navigate command prompt to your local project folder and type below command.
git init

Task 3 :

below command add the files in your new local repository. This stages them for the first commit.
git add .

Task 4 :

Commit those files that you've staged in your local repository sing below command . In below command "MyCommit" is user defined.
git commit -m "My commit"

Task 5 :

Now in command prompt , add the URL ( Ex : https://github.com/revera/sample-repo.git ) of the remote repository where your local folder will be pushed.
git remote add origin remote https://github.com/revera/sample-repo.git

Task 6 :

Navigate command prompt to your local project folder and type below command.
git remote add github https://github.com/revera/sample-repo.git

Task 7 :

Push your local directory to GitHub using below command .
git push origin master

Task 7 :

Now , Command prompt will ask you for username and password of GitHub.


Related Articles
Recent Articles
Most Viewed Articles