2

I am working on a project of mine and I got the codes uploaded in github. I started working in this project from Win10 os and currently I'm working in Arch linux. In windows it didn't use to ask me for any password but it does now.

I've never pushed from my linux before. Today when I tried to push the terminal and VB code both are asking for my github username and password.

I kept a backup of this project at my usb hard drive and currently I pasted it in my linux ssd. What I'm saying is I didn't clone it from the repo. As far as my global username & user email are concerned both are accurate. I'm not using any SSH so when I type git remote -v in my terminal it shows https link as the origin for both fetch and push.

Why is it asking for my username and password? Is it secure to provide my password? In case if I provide my credentials then do I have to provide it every time I push? How to fix this?

I have searched stackoverflow for solution but the other questions that I have found doesn't match my criteria cause in windows it was working fine without asking any credentials.

1

2 Answers 2

4

So, I have updated my origin remote from https to ssh and added a ssh public key to my github account after creating one which is well defined by github finally my problem solved and now I can push to my repo without any credential prompt by the terminal.

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

1 Comment

To clarify some terminalogy, the name "origin" is what is called a remote.
1

While in general, providing a username and password to git is secure, GitHub no longer allows authentication with username and password. Instead, you need to either use ssh or generate a personal access token.

See source for details.

4 Comments

Hi. But couple of weeks ago in Windows it never asked me for my username and password. Then why is it asking now? I never saw git asking for my credentials. Why is that?
@MD.SaffanAlvy I'm not sure what would cause that. I haven't used HTTPS to access my repositories on GitHub for years. I use SSH instead and never have to enter a password.
I have updated my origin from https to ssh. Now when I push it is saying that the authenticity of host 'github.com' can't be established. The key fingerprint is this. This key is not known by any other names. Are you sure you want to continue connecting? When I say yes, it says [email protected]: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. What do I do now?
@MD.SaffanAlvy I suggest googling "github ssh" to find the official github documentation and follow the steps given there. You will need to generate an SSH key and upload the public key to GitHub. The docs tell you exactly how to do this.

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.