0

I've already written some code and now wish to upload it to git hub via command line.

Am I correct in the process?

Set up a project on git hub via browser.

Go to my projects directory and perform via command line:

git init

Next perform:

git add *

Then:

git commit -am "first commit'

Then what is the difference between:

git push origin master
git remote add origin

Also, I've followed a tutorial about using two accounts, how would this integrate with the above steps every time I wish to commit?

The tutorial stated:

git remote add origin git@github-mySecondUser:mySecondUser/test.git

How would it work with push?

1 Answer 1

4

git remote add origin ...adds a remote git repo and names it 'origin'. If you don't execute this command, you won't have any remote configured for your local repo, and you will thus not be able to push to the remote github repo.

git push origin master pushes the commits of your local master branch to the remote repo named 'origin'.

See http://www.git-scm.com/book/en/Git-Basics-Working-with-Remotes for more information.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.