Last active
November 9, 2015 18:15
-
-
Save keum/7968d41f2d22728c47e0 to your computer and use it in GitHub Desktop.
How to: Using GitHub Local Scenario 1 - Local project to GitHub repo using terminal command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scenario 1: One starts the project in your local directory and need to push whole directory into your repository in GitHub website. | |
===================================================================================================================================== | |
Step 1: Create a github repo in the web WITHOUT README.md file. | |
Step 2: Go to your local machine and to the directory where all the files are located. Example >cd yourdirectory | |
Step 3: Go create README.md file. Example Type $touch echo "#new repo" >> README.md (this creates a new README.md file with new repo text inside) | |
Step 4: Still in your local directory where your project directory is, | |
$ git init | |
Step 5: $ git add README.md | |
Step 6: $ git commit -m 'first commit' (need to type exactly first commit) | |
Step 7: $ git remote add origin remote repository URL i.e. http://your repository.git | |
Step 8: $ git remote -v #verifies the new remote URL | |
Step 8: $ git push origin master #pushes the changes in your local repository up to the remote repository you specified as the orgin | |
After these steps you should see your README.md file in the GitHub repository same as one in your local directory. | |
Now add rest of the file by $ git add . (this adds all the files) | |
$ git commit -m 'message' (again write why you're making the commit) | |
$ git push | |
This should now push all your local project directory into the repository you created in GitHub site. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FATAL ERROR: remote origin already exist - stackoverflow suggestion.
As the error message indicates, there is already a remote configured with the same name. So you can either add the new remote with a different name or update the existing one if you don't need it:
To add a new remote, called for example github instead of origin (which obviously already exists in your system), do the following:
$ git remote add github [email protected]:ppreyer/first_app.git
Remember though, everywhere in the tutorial you see "origin" you should replace it with "github". For example $ git push origin master should now be $ git push github master.
However, if you want to see what that origin which already exists is, you can do a $ git remote -v. If you think this is there by some error, you can update it like so:
$ git remote set-url origin [email protected]:ppreyer/first_app.git