Explain HTTP push when using 2FA #87

Closed
opened 1 year ago by ivan-paleo · 33 comments

I have just activated 2FA and found that I could not push from VScode anymore. The log pointed me to the token, but it took me some time to find where to generate it (I was expecting the setting to be in "security" and not "applications").
This shoulbe documented in the help. I suggest we add that to the 2FA article.

Additionally, on Windows, this is not so easy to update the credentials. You would expect that it asks you again to enter your credentials, but it doesn't. It happened to me already so I know how to do it via the Credential Manager, but this is not straightforward. I would also add this.
I do not know about macOS/Linux.

I have just activated 2FA and found that I could not push from VScode anymore. The log pointed me to the token, but it took me some time to find where to generate it (I was expecting the setting to be in "security" and not "applications"). This shoulbe documented in the help. I suggest we add that to the 2FA article. Additionally, on Windows, this is not so easy to update the credentials. You would expect that it asks you again to enter your credentials, but it doesn't. It happened to me already so I know how to do it via the Credential Manager, but this is not straightforward. I would also add this. I do not know about macOS/Linux.
lhinderberger added the
Kind: Documentation
label 1 year ago
lhinderberger changed title from Add details about token when using 2FA to Explain HTTP push when using 2FA 1 year ago
lhinderberger added the
Status: Needs feedback
label 1 year ago

This problem is not present when using Git over SSH.

Please explain what token you mean?

This problem is not present when using Git over SSH. Please explain what token you mean?
Poster

I guess it's only for HTTP.

I guess it's only for HTTP.

Is there a way to provide a generic explanation of this problem in Documentation? Because it would probably be an exhausting task to list how to add the token in all different GUIs, Git Clients, IDEs etc.

Is there a way to provide a generic explanation of this problem in Documentation? Because it would probably be an exhausting task to list how to add the token in all different GUIs, Git Clients, IDEs etc.
Poster

The token is generated via Codeberg.org. On Windows, the Credential Manager manages the credentials (see the article on installing Git on Windows) so they have to be saved only once and can be used by all apps.

So for Windows at least, this can be very easy to expand the 2FA article.

Or have I misunderstood you?

The token is generated via Codeberg.org. On Windows, the Credential Manager manages the credentials (see the article on installing Git on Windows) so they have to be saved only once and can be used by all apps. So for Windows at least, this can be very easy to expand the 2FA article. Or have I misunderstood you?

That is good. Your reference to VS Code made it seem as if there were different ways to do this for each IDE.

That is good. Your reference to VS Code made it seem as if there were different ways to do this for each IDE.

@ivan-paleo Would you like to extend the article? :)

@ivan-paleo Would you like to extend the article? :)
lhinderberger added
Status: Help wanted
and removed
Status: Needs feedback
labels 1 year ago
Poster

@ivan-paleo Would you like to extend the article? :)

Yes, I will try to do it this week, but I'm not sure I'll have enough time.

> @ivan-paleo Would you like to extend the article? :) Yes, I will try to do it this week, but I'm not sure I'll have enough time.
Poster

Before I start working on it, I have a somewhat important question:

I have forked the Documentation repo some time ago. Since then, quite a few things happened on the main repo.
So should I somehow update my outdated fork from the main repo before continuing working on it?

That sounds like a good idea to me, but I have no idea on how to do that. Alternatively, I could re-fork, but I'm not sure how it is to work with 2 forks of the same repo.

EDIT: something to add to the contributor FAQ #92 maybe?

Before I start working on it, I have a somewhat important question: I have forked the Documentation repo some time ago. Since then, quite a few things happened on the main repo. So should I somehow update my outdated fork from the main repo before continuing working on it? That sounds like a good idea to me, but I have no idea on how to do that. Alternatively, I could re-fork, but I'm not sure how it is to work with 2 forks of the same repo. EDIT: something to add to the contributor FAQ #92 maybe?
hw commented 1 year ago
Owner
see https://docs.codeberg.org/collaborating/pull-requests-and-git-flow/
Poster

see https://docs.codeberg.org/collaborating/pull-requests-and-git-flow/

Is there also a way to do it through the Codeberg web interface and/or on VSCode/VSCodium?

> see https://docs.codeberg.org/collaborating/pull-requests-and-git-flow/ Is there also a way to do it through the Codeberg web interface and/or on VSCode/VSCodium?

So should I somehow update my outdated fork from the main repo before continuing working on it?

Yes, that's a good idea. If you have already started working, you want to rebase it as described in @hw's link. If you haven't it's easier to pull the newest upstream changes into your local master branch and to then create a new branch from that.

EDIT: something to add to the contributor FAQ #92 maybe?

I'd like to keep that focused on Documentation-specific topics, not so much on general Git usage. That's what the "Working with Git repositories" section is for.

> So should I somehow update my outdated fork from the main repo before continuing working on it? Yes, that's a good idea. If you have already started working, you want to rebase it as described in @hw's link. If you haven't it's easier to pull the newest upstream changes into your local master branch and to then create a new branch from that. > EDIT: something to add to the contributor FAQ #92 maybe? I'd like to keep that focused on Documentation-specific topics, not so much on general Git usage. That's what the "Working with Git repositories" section is for.
Poster

If you haven't it's easier to pull the newest upstream changes into your local master branch and to then create a new branch from that.

That's exactly what I would like to do, but how do I pull from the upstream (original) master into my master branch?

Is it just the same procedure without rebase (git pull --rebase upstream master)?

> If you haven't it's easier to pull the newest upstream changes into your local master branch and to then create a new branch from that. That's exactly what I would like to do, but how do I pull from the upstream (original) master into my master branch? Is it just the same procedure without rebase (`git pull --rebase upstream master`)?

Yes, you pull from upstream by executing git pull upstream master. In VSCode / Codium you can pull from the Git tab by clicking on the "..." Button -> "Pull, Push" -> "Pullen von..." (I assume "Pull from..." in English 😉).

Make sure you're on your master branch though before doing this.

Yes, you pull from upstream by executing `git pull upstream master`. In VSCode / Codium you can pull from the Git tab by clicking on the "..." Button -> "Pull, Push" -> "Pullen von..." (I assume "Pull from..." in English :wink:). Make sure you're on your master branch though before doing this.
Poster

Yes, you pull from upstream by executing git pull upstream master. In VSCode / Codium you can pull from the Git tab by clicking on the "..." Button -> "Pull, Push" -> "Pullen von..." (I assume "Pull from..." in English 😉).

That sounds exactly what I was looking for.
Just one more detail: I should then "pick a remote to pull from". I guess I should specify the master branch of the repo, but in which format?

Sorry for these basic questions...!

> Yes, you pull from upstream by executing `git pull upstream master`. In VSCode / Codium you can pull from the Git tab by clicking on the "..." Button -> "Pull, Push" -> "Pullen von..." (I assume "Pull from..." in English :wink:). That sounds exactly what I was looking for. Just one more detail: I should then "pick a remote to pull from". I guess I should specify the master branch of the repo, but in which format? Sorry for these basic questions...!

That format should be the same as the URL you use when cloning a repository.

That format should be the same as the URL you use when cloning a repository.
Poster

That format should be the same as the URL you use when cloning a repository.

That was the obvious one that I tried (sorry for not mentioning, Friday was busy), and it doesn't work: VSCodium doesn't let me validate it and does nothing.
Maybe I should specify the branch somehow?

> That format should be the same as the URL you use when cloning a repository. That was the obvious one that I tried (sorry for not mentioning, Friday was busy), and it doesn't work: VSCodium doesn't let me validate it and does nothing. Maybe I should specify the branch somehow?

It could be that you first need to add this repository as your upstream repo using "..." -> "Remotes" -> "Remoterepository hinzufügen..." (something like Add Remote Repository).

It could be that you first need to add this repository as your upstream repo using "..." -> "Remotes" -> "Remoterepository hinzufügen..." (something like Add Remote Repository).
Poster

It could be that you first need to add this repository as your upstream repo using "..." -> "Remotes" -> "Remoterepository hinzufügen..." (something like Add Remote Repository).

I feel really stupid now, but I've added the remote, and I can now select it in "pull from", but then it asks for the branch. "master" does not lead me further...

> It could be that you first need to add this repository as your upstream repo using "..." -> "Remotes" -> "Remoterepository hinzufügen..." (something like Add Remote Repository). I feel really stupid now, but I've added the remote, and I can now select it in "pull from", but then it asks for the branch. "master" does not lead me further...

"master" does not lead me further...

Why not - is there an error message?

> "master" does not lead me further... Why not - is there an error message?
Poster

"master" does not lead me further...

Why not - is there an error message?

That would be nice, but no: I just cannot validate (pressing ENTER does not do anything)

> > "master" does not lead me further... > > Why not - is there an error message? That would be nice, but no: I just cannot validate (pressing ENTER does not do anything)

Can you bring up a terminal in VSCodium and have a look at the output of git status and git remote -v? Maybe that brings up more clues on what went wrong.

And if you're already in the terminal, you might as well pull from there too. The command is git pull upstream master, assuming your upstream remote is called upstream.

That's the thing with GUIs: They seem easy, but looking closer they're suprisingly complex. In addition, there's no short, concise and easy way to put GUI workflows in writing whereas for terminal apps it's often just a one-liner. That must be why many developers prefer to do things on the terminal.

Can you bring up a terminal in VSCodium and have a look at the output of `git status` and `git remote -v`? Maybe that brings up more clues on what went wrong. And if you're already in the terminal, you might as well pull from there too. The command is `git pull upstream master`, assuming your upstream remote is called `upstream`. <sub>That's the thing with GUIs: They seem easy, but looking closer they're suprisingly complex. In addition, there's no short, concise and easy way to put GUI workflows in writing whereas for terminal apps it's often just a one-liner. That must be why many developers prefer to do things on the terminal.</sub>
Poster

@lhinderberger are you trying to bring me to the dark side?! ;)

@lhinderberger are you trying to bring me to the dark side?! ;)
Poster

Here the output:

PS ...\Documentation> git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean

PS ...\Documentation> git remote -v
origin  https://codeberg.org/ivan-paleo/Documentation.git (fetch)
origin  https://codeberg.org/ivan-paleo/Documentation.git (push)
upstream        https://codeberg.org/Codeberg/Documentation.git (fetch)
upstream        https://codeberg.org/Codeberg/Documentation.git (push)
Here the output: ``` PS ...\Documentation> git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean PS ...\Documentation> git remote -v origin https://codeberg.org/ivan-paleo/Documentation.git (fetch) origin https://codeberg.org/ivan-paleo/Documentation.git (push) upstream https://codeberg.org/Codeberg/Documentation.git (fetch) upstream https://codeberg.org/Codeberg/Documentation.git (push) ```
Poster

git pull upstream master indeed works very easily and smoothly...!

`git pull upstream master` indeed works very easily and smoothly...!

Here the output: [...]

Looks perfectly fine to me. 👍

git pull upstream master indeed works very easily and smoothly...!

That's very good to hear :)

@lhinderberger are you trying to bring me to the dark side?! ;)

Hehe, yes 😄 Using git from the command line will have a bit of a learning curve, but I think it'll make your life easier in the long run. Especially when running into more advanced problems, instructions tend to be focused on the command line.

> Here the output: [...] Looks perfectly fine to me. :thumbsup: > `git pull upstream master` indeed works very easily and smoothly...! That's very good to hear :) > @lhinderberger are you trying to bring me to the dark side?! ;) Hehe, yes :smile: Using git from the command line will have a bit of a learning curve, but I think it'll make your life easier in the long run. Especially when running into more advanced problems, instructions tend to be focused on the command line.
Poster

Hehe, yes 😄 Using git from the command line will have a bit of a learning curve, but I think it'll make your life easier in the long run. Especially when running into more advanced problems, instructions tend to be focused on the command line.

I've already noticed that ;)

By the way, I don't quite understand this syntax from the documentation:
git remote add upstream git@codeberg.org:Codeberg/build-deploy-gitea.git
What is the git@codeberg.org: for?
Why not the whole repo URL, like https://codeberg.org/Codeberg/build-deploy-gitea.git?

> Hehe, yes :smile: Using git from the command line will have a bit of a learning curve, but I think it'll make your life easier in the long run. Especially when running into more advanced problems, instructions tend to be focused on the command line. I've already noticed that ;) By the way, I don't quite understand this syntax from the documentation: `git remote add upstream git@codeberg.org:Codeberg/build-deploy-gitea.git` What is the `git@codeberg.org:` for? Why not the whole repo URL, like `https://codeberg.org/Codeberg/build-deploy-gitea.git`?

That's because it's an SSH path, not an HTTPS URL. The article assumes you're connecting over SSH.

That's because it's an SSH path, not an HTTPS URL. The article assumes you're connecting over SSH.

What is the git@codeberg.org: for?

It signifies that the connection via SSH should be done to host codeberg.org using system username git for connection, with your SSH key identifying you as the actual codeberg user. The SSH protocol is implied (I would like it to be explicit too, but I can't get it to work by prepending ssh://).

> What is the `git@codeberg.org:` for? It signifies that the connection via SSH should be done to host codeberg.org using system username `git` for connection, with your SSH key identifying you as the actual codeberg user. The SSH protocol is implied (I would like it to be explicit too, but I can't get it to work by prepending `ssh://`).
Poster

What is the git@codeberg.org: for?

It signifies that the connection via SSH should be done to host codeberg.org using system username git for connection, with your SSH key identifying you as the actual codeberg user. The SSH protocol is implied (I would like it to be explicit too, but I can't get it to work by prepending ssh://).

Thanks for the explanations! SSH is the next thing I have to look into...!

> > What is the `git@codeberg.org:` for? > > It signifies that the connection via SSH should be done to host codeberg.org using system username `git` for connection, with your SSH key identifying you as the actual codeberg user. The SSH protocol is implied (I would like it to be explicit too, but I can't get it to work by prepending `ssh://`). Thanks for the explanations! SSH is the next thing I have to look into...!

You're welcome! :)

You're welcome! :)
Poster

I'm having troubles with this article. Not with the creation of tokens (that's very easy), but with the management of credentials.
I still haven't quite understood how it works on Windows (the "new" Git Credential Manager Core does not save the credentials on my machine - I've opened issue #188) and I don't know how to configure it: how to save more than 1 token per machine? how to save the token only for say 15 min? how to make sure the token is never saved (e.g. if you use a password manager)? And of course, I have no idea about macOS or Linux.

I think this is an important topic too, but it probably deserves its own article, right? If that's indeed the case, I will just stop at the creation of the token and saying "save it in a safe place" or something. Later we can add a link to the new article.

What do you guys think?

EDIT: of course, all that relates to HTTP only. I know that most of you use SSH.

I'm having troubles with this article. Not with the creation of tokens (that's very easy), but with the management of credentials. I still haven't quite understood how it works on Windows (the "new" [Git Credential Manager Core](https://github.com/microsoft/Git-Credential-Manager-Core) does not save the credentials on my machine - I've opened [issue #188](https://github.com/microsoft/Git-Credential-Manager-Core/issues/188)) and I don't know how to configure it: how to save more than 1 token per machine? how to save the token only for say 15 min? how to make sure the token is never saved (e.g. if you use a password manager)? And of course, I have no idea about macOS or Linux. I think this is an important topic too, but it probably deserves its own article, right? If that's indeed the case, I will just stop at the creation of the token and saying "save it in a safe place" or something. Later we can add a link to the new article. What do you guys think? EDIT: of course, all that relates to HTTP only. I know that most of you use SSH.
Poster

I have added some details in PR #97

I have added some details in PR #97
Poster

I guess this issue can be closed now, right?

I guess this issue can be closed now, right?
lhinderberger closed this issue 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.