Pushing to GitHub
-
Hi!
I took several attempts to push code to GitHub but I cannot figure out how to do it. I saw the posts here and I worked through the GitHub help. I also tried YouTube.The setting:
I have an GitHub account with a few projects. These projects date back some years and I have pushed code successfully to GitHub. Also I saw that there were changes regarding signing in and I created a SSH key and connected it to my account as described in the GitHub manual.The issue:
Wenn I use git push I am asked for a username and password. When I fill in my GitHub credentials I get the error that this method is deprecated.What am I missing? How can I switch to the new login method?
Thanks for your help!
-
Hi!
Thanks for your input. I think I got it working again. My local repo was set to use https. This can be checked with:
git remote show origin
I used
git remote set-url origin git+ssh://git@github.com/username/reponame.git
To change it to ssh.
After that I am able agin to push from the command line and through Qt Creator.
I do not know yet how to set up a project correctly in the first place but I hope this helps other to get their old repos working again. Reminder, a ssh key needs to be setup first. See here for instructions.
-
@Sikarjan-0 Hi
I would not advice you to put manually your credential when you want to push with git, because there is a timeout for that.If you don't respect it you will always encounter errors.1.If you have added your git account to git command line, you have to firstly commit to the local repository, then use git push after
2.The easiest way is to register your git account in your webbrowser, so that each time its ask the browser will open and login automatically -
@Sikarjan-0
Hi. I use git & github, but I find it incredibly difficult/arcane. So many commands, so complex. I do not use it through Creator, as I use it outside of Qt too, I use the command line. I don't know if that relates to your situation. I shall be interested to learn from this thread too.I will try to help from what little I know/understand. You have heard of "The blind leading the blind", this is another one: "In the land of the blind the one-eyed man is King". You are the blind, I have the faulty one eye! Take everything I say with a pinch of salt as I may be wrong!
I presume you mean you already have a local git repository and you want to push from that to github, right? I too have set up to use SSH key rather than password. In your git settings for your project/repo have you changed over the
remote
address from usinghttps
to usingssh
on the Url? I thought that is what is required, while you use HTTPS it will still prompt for username+password?Or am I quite wrong here? I can see @Ronel_qtmaster has posted while I was typing, perhaps he can correct me. Also I don't know about "web browser" and opening/logging in automatically, I do not use any such, I just use a command line from Linux. It works fine with no prompting. I don't know the relationship between that way and webbrowser.
-
Hi!
Thanks for your input. I think I got it working again. My local repo was set to use https. This can be checked with:
git remote show origin
I used
git remote set-url origin git+ssh://git@github.com/username/reponame.git
To change it to ssh.
After that I am able agin to push from the command line and through Qt Creator.
I do not know yet how to set up a project correctly in the first place but I hope this helps other to get their old repos working again. Reminder, a ssh key needs to be setup first. See here for instructions.
-
-
@Ronel_qtmaster said in Pushing to GitHub:
when you install git and you do not setup your account locally
I don't really know what that means. Once I changed over from https to ssh (with my SSH key set up in local file) it never asks for credentials again without my having to do anything and no matter where I use it from (no requirement for web browser). That seems to be @Sikarjan-0's case now, and is all I know.
-
@Ronel_qtmaster said in Pushing to GitHub:
I am using Git with https.Never though of switching to SSH though
You may know more than I. Does/doesn't this mean that every time you want to use it you have to log in (providing credentials) once (per reboot)? You might do that login in a web browser, I don't know? Once I was advised to set up ssh (with that credentials file stored somewhere hidden down inside my home directory) I never get prompted to enter them again, anything that wants credentials just automatically takes it from there. I am glad I moved from https to ssh, even though I forget the details.
-
@JonB said in Pushing to GitHub:
@Ronel_qtmaster said in Pushing to GitHub:
I am using Git with https.Never though of switching to SSH though
You may know more than I. Does/doesn't this mean that every time you want to use it you have to log in (providing credentials) once (per reboot)? You might do that login in a web browser, I don't know? Once I was advised to set up ssh (with that credentials file stored somewhere hidden down inside my home directory) I never get prompted to enter them again, anything that wants credentials just automatically takes it from there. I am glad I moved from https to ssh, even though I forget the details.
Something to think about: either your ssh key is not protected by a password or it's unlocked because it's configured in your system keychain (or equivalent). If the former, I would advise to reconsider as if the file gets accessed without your knowledge, everything you have access to with it will be as well to that other person.