sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
273 stars 14 forks source link

Prompts for password with every push to origin #214

Open Fotiman opened 5 years ago

Fotiman commented 5 years ago

Version info

OS: Windows 10 Build: 1075

Description

Starting with Build 1075, every time I push to origin, it prompts me for a password. git config credential.helper manager Remote repository is accessed using HTTPS. This thread suggests that the problem is fixed by not using the bundled version of Git: https://forum.sublimetext.com/t/build-1075-keeps-prompting-for-credentials/39884/11

Steps to reproduce

Open repository ... Click on Push (Ctrl+Alt+Up)

Expected behavior

After I've been authenticated, it should not prompt me again for a password.

jasonycw commented 5 years ago

I think this is not limited to Build 1075 I am on 1085 and in this few days, it keeps asking me to login to git every few minutes. When it fetches in the background, 5 GitHub Login prompts will pop up and ask me to login again image

FYI, I have GitHub MFA turned on and using SM's bundled git

edit: Happen on both bundled and system git, 7 times today already

tajmone commented 5 years ago

Same credentials problem with SM 1097 when using a personal Gitblit server in my intranet (over SSH), regardless of the Git binary bundled/system settings. On my Git CLI credentials are working fine and I don't get asked every time.

I don't get asked for credentials with GitHub via HHTP though, only on Gitblit via SSH.

Fotiman commented 5 years ago

I'm on build 1103 now, and I'm no longer seeing the issue. Are any others still seeing this issue in build 1103? @tajmone @jasonycw ?

tajmone commented 5 years ago

I had to manually install Build 1103 because Build 1102 wouldn't see the update as available.

And, yes, Build 1103 still naggers me with password request whenever it accesses the remote server on intranet (Git Blit stack).

jasonycw commented 5 years ago

Build 1102 wouldn't see the update 1103 as available too.

But 1102 seems to have no password prompt for quite a while (using GitHub directly)

tajmone commented 5 years ago

But 1102 seems to have no password prompt for quite a while (using GitHub directly)

I wonder if the fact that it keeps asking me for the password on my GitBlit intranet server is due to configuration issues. When I use command line Git everything works fine, for some reason SM doesn't seem to be picking those user settings for credentials.

Having to re-enter the password for every push/pull and fetch operation really makes SM rather unfriendly to use with my intranet repositories.

I hope that on the SM online documentation there will be added a page regarding settings for credentials, etc.

burki169 commented 5 years ago

I have the same password prompt issue when I connect to my BitBucket repository over SSH. I've tried using system and bundled version of Git but no luck. I'm using Build 1107

ian-nisbet commented 5 years ago

I have the issue with BitBucket. System git does not bother me for authentication, but bundled git does.

Toddses commented 5 years ago

I am on build 1116 and am having this issue.

Toddses commented 5 years ago

As a follow up, yesterday it suddenly started working and I no longer had to enter my password.

Now, today, its asking for my password on every remote action again.

I have Password Caching set to 1 week. And I'm using the system git.

tajmone commented 5 years ago

From this morning (2019/08/04) SM started to prompt me for users & pass also on GitHub (no SM updates, so I guess something might have changed on GitHub settings that introduced the same problem I was experiencing with Bitbucket).

This is becoming a serious problem, if SM starts nagging for user and password on every push operation also on GitHub then it becomes unusable for Git related work.

Right now, I'm asked for account credentials on every push operation on:

This problem has been pending a solution for quite a long time now (10 months since the issue was opened), and has only got worse. If it doesn't get fixed, I'll have to consider moving to another Git GUI tool (or to VSCode, which offers Git integration directly in the editor).

hkchakladar commented 4 years ago

Issue still persist and asking for password in each push.

tajmone commented 4 years ago

May 2020, SM build 2011, and the problem persists (the Issue was opened 2 years ago).

I can't understand why SM fails to see the Git credential files stored on my system (Win 10), while all other Git instances and front-ends pick them up correctly.

SM should ask for the password only once, and then store it somewhere.

I've found a Forum post that mentioned the menu option Tools > Passowrd Caching, but I can't see that menu in the current edition:

https://forum.sublimetext.com/t/sublime-merge-remember-git-account/39451/3

The inability to cache credentials is a serious issue which jeopardizes the benefits of using SM for everyday work. In my case, I'm facing the issue with a local GitBlit server installed in my Intranet, and connecting via SSH. Having to enter the password for each push operation is really annoying.

Is there an ETA for when this problem can be fixed? Two years is quite a long time for a bug that affects a core feature like credentials storage in an app that's dedicate to Git usage — and, to be honest, long enough to discourage license renewal when the time arrives.

Sorry for the pessimistic tone of this last post, but try to stand in my shoes and imagine having to type a rather long and articulate password with every push operation, day by day, hundreds of times, while working locally on my private projects. Either that or having to constantly switch to Bash for push and write operations. Not pleasant, at all, and was really hoping for a fix to the problem after two years.

Fotiman commented 4 years ago

With 473 open issues (and only 286 closed), and 12 months between releases, it would seem that this project is not getting any serious attention. As much as I loved Sublime Merge initially, this issue is a showstopper for me. Authentication problems should get the highest priority, but this bug isn't even assigned to anyone.

dpjohnst commented 4 years ago

Hi all,

I want to start off by apologizing that this issue has affected your workflow for such a long time, and thank you for your patience. I will do everything I can to see this gets resolved.

I have been debugging this issue, and I have been able to replicate the issue with SSH, but not HTTPS. I'll be looking to get this SSH issue fixed as soon as possible.

For those seeing the issue with HTTPS, it's likely there is a configuration issue with Git. When you get a chance, could you perform the following steps:

Additionally, could you confirm that the credentials are being stored by Windows?

Thank you again for your patience, and for reporting this issue.

Kind regards, - Dylan

tajmone commented 4 years ago

Hi @dpjohnst , thanks for the reply. As for the first test, I attempted with various keybindings but none showed any results in SM Git output panel (always says No previous commands history).

As for the credentials in the Control Panel, I can see all the http credentials for GitHub, GitLab, Bitucket, etc, under Generic Credentials (of course, no reference to my NAS, since I use SSH only there).

As for the NAS/SSH problem, I've found a workaround which seems to work, i.e. to define on each repository a new user, email and password in its Git configuration — because I noticed that SM was falling back to my standard account (GitHub), unlike Git CLI. This is not an ideal solution, but at least it restricts the problem. Somehow Git CLI is picking up the credentials on a per URL basis, but SM is not.

No idea how to fix that except by changing the .git/config of each repository (because I use the MicroSoft credentials manager instead of Git's native, it seems I can't use some of the options that enable per-URL based credentials, as supported by Git's native manager).

dpjohnst commented 4 years ago

Hi @tajmone,

Thank you for your response! To confirm, you are only seeing the issue for SSH?

Without seeing your setup, most likely what is happening here is that your terminal has a ssh-agent associated with it. Could you confirm whether or not the following returns any output from the terminal: ps aux | grep -i 'ssh-agent'

Additionally, if you launch Sublime Merge from the terminal, do you see the prompt for the SSH passphrase every time? Most likely /c/Program\ Files/Sublime\ Merge/sublime_merge.exe depending on where it's installed.

Thanks, - Dylan

tajmone commented 4 years ago

Hi @dpjohnst. While answering your reply I've updates SM to Build 2021 /in case this makes any difference).

To confirm, you are only seeing the issue for SSH?

No, also with HTTPS with some Git services, e.g. with Bitbucket where I get their login pop-up three times, plus the user and password popus from SM after. Again, it doesn't seem that SM is able to memorize credentials for Bitbucket, whereas it works fine with GitHub and GitLab. I've tested pushing to Bitbucket right now, since I haven't been doing so for quite a while, and problem remains unchanged since my first bug report.

Could you confirm whether or not the following returns any output from the terminal:

ps aux | grep -i 'ssh-agent'

Tried it on Git's Bash, no output whatsoever.

if you launch Sublime Merge from the terminal, do you see the prompt for the SSH passphrase every time?

I've tried the above steps with a Bitbucket repository via HTTPS, by launching SM from Git Bash, and I confirm it didn't ask me for credentials (not even on the first push). Right now I can't try this with SSH because of the above mentioned mod to the Git settings where I've manually added the user and password for each repository on my NAS drive — if you still need me to do that test I'll need to find a free time slot to unroll all those changes, but since the HTPPS test turned out to no longer ask for credentials I think that it might have answered already your question.

So, from what I've gathered so far, it seems to be an issue of SM trying to use the default/main Git account for all repositories (in my case, the GitHub account is the main account) and for some reason not being able to associate different accounts with different services.

The above tests seem to indicate that the problem is likely to be fixable without major changes, for it probably boils down to environment settings that are interfering with Git configurations (and associated tools).

eka7a commented 4 years ago

Hi, You can use pageant to avoid entering a password every time. https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

petefox commented 3 years ago

I'm wondering if anyone ever found a solid solution for this?

I'm experiencing the same issue with SSH, where I'm prompted for passphrase on every pull/push. Looking to buy this for our entire team, but after testing it on several other dev's machines and experiencing the same, we need to wait for now - which is obviously such a shame.

Anyways - we have been using Git Bash up until now, where we just run this on launch: eval 'ssh-agent -s' ssh-add ~/.ssh/*_rsa

But that doesn't seem to work in SM. I also tried making a similar custom command, but that didn't help either.

dpjohnst commented 3 years ago

Hi @PeteFox,

Thank you for the question!

Assuming you're on Windows, the best approach currently is to use Pageant/Plink to authenticate.

You can download these tools (bundled with PuTTY) here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

You can load your SSH keys into pageant, then set up Sublime Merge to use Plink (via Preferences > Advanced > GIT_SSH).

If you'd like a more detailed walkthrough, let me know and I can definitely write one up!

Thanks, - Dylan

tajmone commented 3 years ago

Assuming you're on Windows, the best approach currently is to use Pageant/Plink to authenticate.

Thanks @dpjohnst! This is an excellent workaround to the problem.

victor871129 commented 3 years ago

That is a long unsolved issue with git command not related to Sublime Merge.

On Github.com make sure you create a PAT: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token

Second. You can also try saving the login user-password to a plain-text file, effective when the operating system credentials fail:

git config --global credential.helper store

Then entering user-password again

KhalebOBrien commented 3 years ago

I don't think the issue is with SM as I experience this issue only when pulling/pushing to private repos on Github. Everything works find for Gitlab.

The solution as stated by @victor871129 tends to solve these perfectly well for me. Just create a PAT on Github, then use it as your password when prompted.

ibrahimBeladi commented 3 years ago

Any updates on this?

carlosgio commented 3 years ago

I'm experiencing the same issue on Linux using a Personal Access Token.

tajmone commented 3 years ago

It's like @victor871129 said, it's now a SM related problem, and his solution worked for me under Win 10 and HTTPS connection (the problem just appeared out of the blue, although login was never asked for GitHub repositories in the past).

GitHub recently updated its security for OAuth, so I guess the old tokens just stopped working.

You should have received an email from GitHub telling you that you need to create a new token. If not, here's the article mentioned in that email:

https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/

EDIT: Note that I also switched from the older store setting to wincred:

git config --global credential.helper wincred

I'm not sure if this affected the problem or not, but with wincred it works.

bnomei commented 3 years ago

i did run into this after dist upgrade on ubuntu. adding my key again solved it. afaik the key is now 70 instead of 64 chars long by default and thats why my old one had to be added explicitly again.

ssh-add ~/.ssh/id_rsa

navidshad commented 2 years ago

Hey Guys You can cache your password for a period of time from this menu:

Tools -> Password Caching -> Select a period of time

rafaelcapucho commented 1 year ago

Hey Guys You can cache your password for a period of time from this menu:

Tools -> Password Caching -> Select a period of time

This option doesn't exist in the latest version of Sublime Merge for Windows, unfortunately I still have to add my password for each pull/push in plan October 2022.

dpjohnst commented 1 year ago

Hi @rafaelcapucho,

This option is only available on Linux and MacOS.

for HTTPS authentication, Git for Windows comes with GCM Core which will handle password caching. For SSH authentication, this is left to Windows to handle.

Could you confirm if you're authenticating via HTTPS or SSH?

Kind regards, - Dylan

skfd commented 1 year ago

Sourcetree asks for ssh password only once, on launch, including on Windows. I'm sure it's a janky implementation, but it works!

tajmone commented 1 year ago

This is issue has been open for almost 5 years no, and many users on different platforms seem to experience this password problem in various contexts. Whatever might be causing the problem (regardless of whether it originates on SM end or in the OS environment and its settings) it seems to me that this is a topic that deserves to be documented in Sublime Merge official documentation — i.e. providing OS specific guidelines on how to properly configure SM, default Git, and OS settings, to optimize password management in ST; and mentioning known problems to which there are no known solutions.

As the situation stands now, the impression is that SM can't manage passwords like other Git GUIs (as @skfd mentioned, other tools handle passwords well, and I can confirm that other Git frontends didn't have this problem), and that this is a long-standing unresolved bug.

When I work on repositories stored in my local NAS, it soon becomes annoying having to re-type the password at each push operation. I've just given up on SM fixing this, and accepted the fact that for Git write operations I have to rely on the terminal.

jozefizso commented 1 year ago

I am on a new MacBook with clean installation. I use PAT with GitHub and on this machine only the Sublime Merge is requesting to authenticate even after few hours.

The same token works on different machine and my other PAT tokens did not caused this behaviour on previous Mac machines.

tajmone commented 4 months ago

Six Years After ... Still Asking for Password!

@dpjohnst wrote:

Assuming you're on Windows, the best approach currently is to use Pageant/Plink to authenticate.

You can download these tools (bundled with PuTTY) here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

You can load your SSH keys into pageant, then set up Sublime Merge to use Plink (via Preferences > Advanced > GIT_SSH).

If you'd like a more detailed walkthrough, let me know and I can definitely write one up!

Thanks, - Dylan

I know it's been four years since you posted your kind offer to help ... but some of us have been trying to fix the problem of Sublime Merge always asking for password for over six years now, to no avail.

I've followed the official SM instructions at Getting Started with Sublime Merge » Remote authentication, but it still doesn't work for me: SM simply hangs forever with every operation once it's set to use Plink (both using native and bundled Git).

I followed all the steps — installed full PuTTY package, converted my private SSH key to PPK format (stored along with the original keys) and added it to Pageant — but something must be wrong in the instructions since it's not working. The SM console doesn't report any error, it's just waiting hanging (SM is still responsive, but any Git operations hang forever).

If you could please go into the details of how you managed to fix it, I'd really appreciate it. I must be missing a step or a setting that is absent from the official SM instructions.

Thanks a lot again!

stinos commented 4 months ago

Assuming you're on Windows, the best approach currently is to use Pageant/Plink to authenticate.

Is that still the case actually? Isn't this a lot easier to not use Putty at all (and ssh authentication, which at least for me is available for literally every git host I deal with)? Windows has had an ssh client for a while now, so if you make a key in ~/.ssh with ssh-keygen and upload the pblic key where needed, you're all set, and SM just uses it? Or am I missing something?

tajmone commented 4 months ago

Windows has had an ssh client for a while now, so if you make a key in ~/.ssh with ssh-keygen and upload the pblic key where needed, you're all set, and SM just uses it? Or am I missing something?

SM does use the SSH key, but it doesn't store the credentials, so I have to type the password with each remote operation, or use Git CLI.

KhalebOBrien commented 4 months ago

@tajmone is your SSH key password protected (when you created the SSH key, did you attach a password to it)? If yes, you would be required to provide that password for every remote operation in which that key is used.

I noticed this on both windows and linux. I was able to escape this by not adding a password to the SSH key (this is not safe though). Also, make sure to use git ssh url instead of https urls when cloning your repository, https authentication always request for credentials unless you add the credentials in windows credential manager (WCM).

In my case, I have multiple git accounts, I use for all of them because I wasn't able to setup multiple credentials on WCM.

KhalebOBrien commented 4 months ago

I don't think the issue is with SM as I experience this issue only when pulling/pushing to private repos on Github. Everything works find for Gitlab.

The solution as stated by @victor871129 tends to solve these perfectly well for me. Just create a PAT on Github, then use it as your password when prompted.

This worked for me in 2020 on windows, but when I switched to linux, I stopped using PAT.

stinos commented 4 months ago

@tajmone @KhalebOBrien thanks for clarifying - the password is the thing I was missing here; literally, as I indeed don't have passwords on my keys.

tajmone commented 4 months ago

@tajmone is your SSH key password protected (when you created the SSH key, did you attach a password to it)? If yes, you would be required to provide that password for every remote operation in which that key is used.

yes, it's password protected. I was hoping that SM could store the credentials though, just like Git command line does.

I don't think the issue is with SM as I experience this issue only when pulling/pushing to private repos on Github. Everything works find for Gitlab.

In my case, it's a private Gitea instance installed on a home server which is online, and I access it via the Internet (not localhost). Hence, I can't really risk having an SSH key without password. I don't recall Gitea supporting PAT. So far, I've only experienced this issue with SM not storing the password on private Git stacks (my homeserver, and a Gitblit stack I have on a NAS in my Intranet, for private use), as for services like GitHub, GitLab, etc., I didn't experience any Issues (with HTTPS protocol, or using PAT).