Vscode-git-graph: Doesn't prompt for the users remote credentials if they are not saved

Created on 28 Jun 2019  路  14Comments  路  Source: mhutchie/vscode-git-graph

Describe the bug
Not sure if this is actually a bug or an ID-ten-T error, but I'm having no luck figuring out what I'm doing wrong if the latter.

The issue is that when I try to push a tag, it hangs forever on the Pushing tag... dialog. My assumption is that it needs my github credentials to continue, but I don't see any means for entering them as in a standard git push from the Source Control sidebar.

What does the bug relate to
List the area(s) this issue relates to, for example:

  • Push tags
  • Git credentials

To reproduce

  1. Create a tag in a repo cloned from a source that requires credentials (GitHub in my case)
  2. Right click on tag and select push tag

Expected behaviour
The tag pushes like billy-o.

Environment

  • OS: Ubuntu 18.04
  • Visual Studio Code Version: 1.32.3

P.S. Git graph is super sweet

bug

Most helpful comment

Thanks for your assistance in troubleshooting this issue.

No sir, thank you. Git Graph makes my coding life better.

Tested creating, pushing, and deleting (including on the remote) a tag with beta.1, and everything works without needing local user/email settings configured.

All 14 comments

Thanks for reporting this issue. Git Graph doesn't detect askpass prompts for usernames or passwords, it assumes that the required credentials have already been saved (either when cloning the repo or from a previous git command that communicates with the remote). The behaviour you are observing appears to match this, as because there isn't a way to enter user credentials the git command doesn't finish executing.

To confirm this is the case for you, if you run git push origin <tag-name> in a terminal window. You should be prompted for your username and password if your credentials are not saved.

This behaviour should be the same for any other git actions that require remote communication (fetching from remotes, push branch or tag, delete remote branch or tag). They will work if the credentials are saved, but not if git prompts the user for credentials.

I'll add support for credential prompts in the next release. In the meantime, you could just save your git credentials so you can use this functionality in Git Graph.

Thanks for the response. My creds are definitely not saved, as pushing from the Source Control sidebar always prompts for creds, as does git from the terminal.

This will be available in v1.10.0.

If you'd like to use it before the next release, you can download v1.10.0-beta.1, and install it following the instructions provided here.

Please confirm that this beta release resolves this issue for you.

I've got 1.10.0-beta.0 installed, but now I can no longer add tags, which worked in the prior release. Error is:


*** Please tell me who you are.

Run

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got '<linuxuser>@<machinename>.(none)')

...but my global config seems to be set up correctly:

~$ cat .gitconfig 
[user]
    email = <my email address>
    name = <my name>

Can you try adding a tag from the terminal to confirm that it is only not working in Git Graph? Do any other Git Graph commands no longer work as well (but still work from their terminal git command)?

I鈥檝e tried adding a tag (and running other Git Graph commands) and haven鈥檛 had any problems with the beta release. (They shouldn鈥檛 be affected by any changes I made to fix this issue.)

Tagging from the terminal works:

$ git tag -a v0.1.0-fake
$

Pushing branches works and now prompts for creds as expected.

Is there anything else you'd like me to check?

Another issue I just discovered is that if I delete a remote branch at the source (e.g. at Github), I can't seem to delete the local tracking branch. Delete Remote Branch errors out with:

error: unable to delete 'foobar': remote ref does not exist

... and I can't seem to find a way to just delete the tracking branch without trying to delete the remote branch first.

Let me know if you'd like me to open a new issue for this or if I'm doing something wrong.

Also, thanks for the help and fixes so far, much appreciated.

  1. Do you get your name and email when running git config user.name and git config user.email?
  2. If you run the commands git config --global user.email "[email protected]" and git config --global user.name "Your Name", setting them to your values, does it now work?
  3. If not, repeat (2) without --global, git config user.email "[email protected]" and git config user.name "Your Name", does it now work?
  4. Does the "Revert..." command also not work (as I think it should also need user.name & user.email) to make the commit?

If none of the above resolved the issue, can you please try the following steps:

  • Install the previous version (1.9.0) & confirm the issue is not present in 1.9.0. (From the Visual Studio Code Extension menu, click on the "Manage" cog and select "Install Another Version...".)
  • Reinstall the beta release & confirm that issue still exists.

As for Delete Remote Branch, this is the expected extension behaviour as you have deleted it on the remote, and the ref does not exist on the remote. You would need to run a command like git fetch --prune to remove your local copy of the remote ref which no longer exists. If you don't delete it from the source first (e.g. at GitHub), running Delete Remote Branch will delete it both on the remote and remove the local remote ref.

  1. Yes
  2. No
  3. Yes
  4. Works if user & email in in the local config, does not work if in global

As for Delete Remote Branch, this is the correct behaviour

It is possible to remove a tracking branch without touching the remote:

$ git branch -d -r origin/foobar
Deleted remote-tracking branch origin/foobar (was 03db095).

Can you please try the following:

  1. Remove the user & email in the local config, so it is just in the global config. (Check that git config user.name and git config user.email still return the correct values from the global config)
  2. Install git-graph-1.10.0-alpha.0.vsix after extracting it from git-graph-1.10.0-alpha.0.zip
  3. Check to see if you can now add a tag
  1. I can indeed!

Pushing tags also prompts for creds as expected.

I've just made a new beta release with this fix in it. Please download v1.10.0-beta.1, and confirm that you can still add tags using the global git config.

Thanks for your assistance in troubleshooting this issue. It was caused because when I set new environment variables for the credentials, I overrode the default behaviour of cp.spawn which is to use process.env. This meant that environment variables defined in process.env were no longer available. Now I use the union of process.env and the new credential environment variables. I'm not sure why not having the environment variables didn't affect Windows, Mac or Remote WSL for me, and was an issue for you on Linux, but I'm glad it is now fixed.

I've raised #115 for deleting the local remote branch ref when running "Delete Remote Branch...", and the branch is already deleted on the remote.

Thanks for your assistance in troubleshooting this issue.

No sir, thank you. Git Graph makes my coding life better.

Tested creating, pushing, and deleting (including on the remote) a tag with beta.1, and everything works without needing local user/email settings configured.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

charlesg99 picture charlesg99  路  6Comments

morganlombard picture morganlombard  路  5Comments

arslivinski picture arslivinski  路  7Comments

ackvf picture ackvf  路  7Comments

marco-m picture marco-m  路  3Comments