Connecting to GitHub repository

This is my first post to the Codecademy forum. I just finished the Git Course in the Web Development Path. I setup a depository on GitHub and committed 3 CSS files and 2 HTML files into it. I set it up using HTTPS (not SSH) so I was prompted to enter my username/password, which I did. Everything worked great.

Now a day latter I have updated a few files and would like to add/commit them to my GitHub repository BUT for the life of me I cannot figure out how to connect to that repository from the command line Terminal (I’m on a Mac). Any guidance would be sincerely appreciated. If this has already been covered please feel free to close this thread and direct me to the proper thread. I tired searching but could not find anything specific to my issue…

Cheers.

you can see the connection using:

git remote -v

which should tell you the remotes and there names (usually origin), so then you can do:

git push origin master

Thank you very much for your help. I really appreciate it :smile::smile:

Okay great I am getting closer but I was getting this error message:

To https://github.com/username/repository-name.git

! [rejected] master -> master (fetch first)

error: failed to push some refs to ‘https://github.com/username/repository-name.git

hint: Updates were rejected because the remote contains work that you do

hint: not have locally. This is usually caused by another repository pushing

hint: to the same ref. You may want to first integrate the remote changes

hint: (e.g., ‘git pull …’) before pushing again.

hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.

I was able to resolve by doing

git pull
due to the master being four edits ahead of origin. Then
git push
then I ran the command again
git push origin master
and lo & behold all my commits synced to my GitHub’s repository.

I do still have one question though. I was not prompted for username and password for the

git push origin master
. I thought I needed to enter this every time I pushed to the GitHub repository since I am not using SSH. How often will I be required to enter my GitHub username/password to push commits to GitHub?

Thank you again :smile:

not sure, i am sure you can find that somewhere on the internet. I think the connection will be kept alive for 15 minutes or so. No idea, use SSH, so much easier.