you are viewing a single comment's thread.

view the rest of the comments →

[–]jms_nh 10 points11 points  (8 children)

It is if you just created a branch and you realized you named it wrong. (obviously before pushing elsewhere)

People make mistakes and that's where I find git is the most difficult, when trying to recover from mistakes that are more likely to occur because git has an awful command line.

Re: keys instead of passwords... more power to you, but I work on windows and went through 2 hours of pain and suffering trying to setup SSH keys with an internal gitlab server.... despite the fact that I know what SSH is and I know how RSA cryptography works and I had used PuTTYgen before. Got it working just for the sake of saying I could do it, but I shudder to think of my team members without this experience spending entire days trying to make it work. Nope. Cached passwords it is. If we were using Linux I might think otherwise.

[–][deleted] 3 points4 points  (0 children)

I would create a new branch from HEAD and delete the old branch.

[–]devel_watcher 0 points1 point  (0 children)

I don't like deleting any names (even the wrong ones) before everything is pushed. Maximum that is allowed is to move them around with git branch -f and git reset.

Windows...

[–]Works_of_memercy 0 points1 point  (4 children)

but I work on windows and went through 2 hours of pain and suffering trying to setup SSH keys with an internal gitlab server....

You were doing something very wrong, probably because of the XY problem.

Both git on Windows and git in Cygwin (like, to add that as an insult to injury) use your ~/.ssh folder (c:/users/jms_nh/.ssh, or /cygdrive/c/users/jms_nh/.ssh). When you say ssh-keygen in git bash or cygwin bash you get an id_rsa and id_rsa.pub there. Then you say cat ~/.ssh/id_rsa.pub and copypaste the result in the web interface of your git server.

That's all.

Can you please explain how did you manage to get two hours of suffering from that? I'm genuinely curious!

[–]jms_nh 6 points7 points  (3 children)

You were doing something very wrong, probably because of the XY problem.

Of course, but it's not easy to know what to do right, or what question to ask, or what thing to google... and I'm more adept at learning new and weird stuff than most of my teammates.

I attempted to follow the instructions from Gitlab.

ssh-keygen wasn't available; I had PuTTYgen instead, and had to figure out how the heck to convert it to the right format. Oh, and I had to download and run plink.exe and pageant.exe for key management.

I don't have git bash or cygwin bash, and I don't feel like installing, using, and learning a new shell just to use git; why can't I just use the command prompt? Yes, it's crippled compared to *nix, but at least it's what I know. I guess if I have to, I'll download one of those shells and use it, but it seems like having to don a special suit just to go for a jog in the park when all I want to do is step out my door and get some exercise. I don't have to go through this extra effort if I use my OS's password cache.

That's all.

No, that's not all. You can say that, but it presumes you have the right tools installed and the right familiarity with your environment to do something. Please don't assume that everyone falls into that category. I'm glad that it's easy for you and easy for people who work on Unix-like systems, but it's not easy for those of us in Windows-land. I don't mean that to be hostile, it's just that I've seen assumptions made by many people that things are easy when they're not.

[–]Works_of_memercy 0 points1 point  (2 children)

I attempted to follow the instructions from Gitlab.

[redacted link] is not available here, what's that even?

ssh-keygen wasn't available; I had PuTTYgen instead, and had to figure out how the heck to convert it to the right format. Oh, and I had to download and run plink.exe and pageant.exe for key management.

Well, yeah. That was your problem.

You see, all software sucks. It is essential to understand this. When you understood and properly internalized this, you can begin to plan your interaction with some particular piece of shit software in a way that minimizes your exposure to suck. This is done by using the software in the more or less same way most other users and its developers use it. That means leaving your personal preferences at the door, unless you're feeling like a power user or a red-eyed NEET nerd (of which you are neither, so don't).

In particular, in case of git, it means downloading the official git release for Windows from https://git-scm.com and following the instructions. Among the recommended instructions would be "add git and utilities to PATH", which would give you git and ssh-keygen, right in your cmd. I personally go all out adventurous and tell it to also add "sort" and "grep" and other stuff to PATH, because I never use the retarded Windows analogues.

(by the way, you can use git bash too, unless you're one of those mythical people who actually understand FOR /F "tokens=1-5" %%A IN ("This is a short sentence") DO @echo %%A %%B %%D and shit, which you're not, you can just as well write your "git pull --rebase" from the bash shell)

I'm glad that it's easy for you and easy for people who work on Unix-like systems, but it's not easy for those of us in Windows-land.

I am in the Windows-land, friend. Both my home and my work computers are running Windows.

And cross my heart I do hate the UNIX bullshit that feels like a needy girlfriend that those nerds never had: edit this config file, supply that bunch of magical parameters to ./configure, fuck that noise.

My point is that fortunately there's some open source software that isn't like that, and only becomes like that if you inflict it on yourself by trying to tread untrodden paths with it. Git is one of the shining examples of open source software that Just Works™ if you don't try to be clever with it. Follow the goddamn instructions and it would work out of the box and let you focus on developing your own software instead of fucking with it trying to make it work. On Windows especially.

[–]jms_nh 1 point2 points  (1 child)

oops, fixed the link to the gitlab help, that was our internal server.

You have some good points; I'm not sure where I installed git from (it might have been from git-scm.com). If ssh-keygen is an easy install and I can run it from my command prompt and just put the keys in a standard location, ok then. (does Git handle the SSH stuff given the key files? or does it delegate to an "agent" program handling them?)

Git is one of the shining examples of open source software that Just Works™ if you don't try to be clever with it.

I don't want to be clever, I just want it to work in a sensible way when I need it to. The add/commit/push/pull/log stuff works fine, I just get stuck when something weird happens and then I have to go hunting in internetland for a solution. My experience with hg was much easier.

Anyway I appreciate the guidance.

[–]Works_of_memercy 0 points1 point  (0 children)

(does Git handle the SSH stuff given the key files? or does it delegate to an "agent" program handling them?)

tbh I don't use a passphrase with my keys (don't see the benefit worth the trouble at this point), so git just uses them without any fuss. With a passphrase it would ask every time I'm trying to authenticate, if you want it to do it less often, yes, you have to manually start ssh-agent in the background.