Asking for password when pushing updates to GitHub - github

I initialized a new repository, and pushed my code to GitHub.
After that, I updated my README file and tried to push on GitHub again, but when I did that, it asks me for password, and it didn't asked me for password when I pushed my code to GitHub for first time.
I also tried entering my GitHub account password, it fails.
I also tried use the key which I generated as a password, but still no luck.
Can anyone please guide me how to solve this problem?
This is the error which I am getting after entering the password:

For HTTPS URL, you need to use a PAT (Personal Access Token) with scope repo as a password.
And you need to cache it using a credential helper, like Git Credential Manager (cross platform). Once that helper is installed:
git config credential.helper manager
Should you switch to an SSH URL (git#github.com:<me>/<myRepo>), you need, if you have protected your private SSH key with a passphrase, to auto-launch ssh-agent when you start a new session. See "Working with SSH key passphrases".

Related

I'm unable to run github cli commands because I keep running into an Authentication Error. I'm using the correct username and password. Details below

I'm following the steps listed here to try and link an existing local project to a new repo on GitHub.
I ran gh repo create but got an Authentication error, with a note to update my credentials in the .gitsomeconfig file. I ran gh configure and entered my GitHub username and my GitHub password (since I chose that option instead of using an authentication token). I entered them exactly the same as I type them in. Then I ran gh repo create again and still ran into the Authentication error. I output the content of .gitsomeconfig and verified that the user_login is correct (It doesn't display my password anywhere).
I've tried running gh configureat least 6 times now. I've copied and pasted from Lastpass to be extra sure I'm entering credentials correctly. I've tried both my username and my email address since I wasn't sure which gh configure actually wanted for username, but neither seem to work. I'm at a loss for what might be going wrong. Any thoughts or suggestions?
The right command is gh auth login, using your GitHub account name and your GitHub token (not password, your PAT: Personal Access Token, with scopes "admin:org, gist, repo, user, workflow")
Then you can check with gh auth status.
Once the status is clean (authenticated), you can proceed with other commands, like gh repo create.

Gitlab: tokenless push to github repo?

I've set up an account on github. I've uploaded my ssh public key.
On github I've created a new empty repo.
In my local environment I've set up git to manage a project. Now I'd like to push the project to github.
When I do 'git push -u origin main', I am asked for my username and password.
The first time I did this I received a message that directed me to the use of tokens. So I created a token. However, now I have to input my token ever time I push to github.
Up until recently I was able to push without entering a password/token thanks to the use of ssh keys. Is it possible to still use this?
If so, how do I get it working?
You can configure username and password by default and it wont ask you again and again, but make sure the username has access to that repository.

Which user does Eclipse login need for push to Github?

I want to use GitHub and Eclipse for my Python project, but I have difficulties with it. Detailed steps are below, this is the short version of the question: I managed to create a repository in GitHub, import it in Eclipse, connect a project to it and make local commits. Now, when I want to push my branch, I have to fill out a username and password. I have tried my GitHub username+password, my SSH key emailaddress + password and my computer username+password, but none of these seem to work. Which username is required in this screen? Is there something else that I am forgetting?
Steps taken so far:
1) Create a GitHub repository
2) Generate a SSH key for my computer, following https://help.github.com/articles/generating-ssh-keys/
3) Import the repository in Eclipse
File -> Import -> Projects from Git -> Clone URI
In Authentication, I fill in my GitHub username and password
4) In PyDev Package Explorer, Team -> Share project
I use the repository just added
5) Without doing anything to the project, I choose Team -> Commit
I commit and push both files
6) Now, it asks me for a login user and password
I have tried my GitHub username+password, my SSH key emailaddress + password and my computer username+password, but none of these seem to work.
Which username is required here?
If you are using an https url, you need your GitHub account username + password.
That is, unless you have 2FA activated (2 Factor Authentication). In which case, you would need a PAT (Personal Access Token)
If you are using an ssh url, then the ssh passphrase would be required (if you protected your private ssh key with a passphrase)
The OP physicalattraction adds in the comments:
It turned out that I used the wrong password. Why was this not discovered in step 3, where I was importing the repository into Eclipse?
That would be because a GitHub repo is by default public (like https://github.com/physicalattraction/aurora_public is), which means no password (no authentication) is required for cloning a repo. Only for pushing to a repo.

Github sign in before a push

When I try to push my project on Github, I have to sign in every time with my Github account before the push. And I don't understand why, on certain projects I don't need to do this, only on one project.
MacBook-Pro-Firstname:ProjectName firstname$ git push origin master
Username for 'https://github.com': email#gmail.com
Password for 'https://email#gmail.com#gmail.com#github.com': *******
How can I remove the sign in process?
GitHub offers two different authentication methods for read/write access. The first, which you appear to be using, is the HTTPS method and requires username/password authentication. The other way is via SSH which uses public/private key pairs to authenticate rather than a username/password combination.
To change the URL of the repository to the SSH version, you can use git config remote.origin.url git#github.com:username/repository.git
It sounds like you already have SSH keys generated and added to your account if you don't need to authenticate for some projects, but if you don't you can set it up via this link.
I am not entirely sure but I believe you will need to create an SSH key: https://help.github.com/articles/generating-ssh-keys
You need to set up a public SSH key with Github. See this article: https://help.github.com/articles/generating-ssh-keys

Why does github keep asking me for repo credentials?

We recently moved our github from one account owner to another, and now all of the sudden when I do a git pull or any git command on the remote repo, it asks me for github username and password.
My git-config says:
[github]
user = kamilski81
token = *********
Any idea how I can stop it asking me for credentials and remember everything, does the new owner have to setup my ssh keys or something of that sort?
Following this article sorted it out for me:
https://help.github.com/articles/why-is-git-always-asking-for-my-password
git remote set-url origin git#github.com:user/repo.git
The github username and token in the gitconfig is only used for interactions with the GitHub API (for instance the hub gem and the github tool).
If you are pushing and pulling from a GitHub repository over https, then you need to specify your credentials every time, or hook into a password manager to remember the credentials for you. How to do this depends on your platform.
The easiest thing to do is to go to your github account and submit your SSH public key to your account, and then switch your github remote to push/pull over ssh instead of https.
[edit] After re-reading the question I noticed that you mentioned it was previously a GitHub repo that was just moved from one owner to another. If that's the case, and you ARE able to push and pull by specifying your credentials, it sounds to me to be one of two scenarios:
The previous remote used ssh, and GitHub has your SSH key; but when the owner changed and you updated the remote, you updated it to go over https.
The previous remote used https, but you had a password manager setup correctly to deal with your credentials, which no longer works.
After doing "remote -v"....the issue was that my remote was using an "https" remote rather than "git" remote. Changing the remote to use git rather than https solved everything.
If you execute only once git pull and Git client still asking you the credential without do the git pull for you, the problem should be because your credential is incorrect or not setup yet.
but if you get the dialog ask for credential one for each operation, it mean that your credential isn't remembered. To do that, you may use Pageant to store your SSH private key, so, everytime you do something, it will retrieve your credential from Pageant instead to asking you.