724

I'm using msysgit running on Windows XP.

Tried Ctrl+V, Right click, Middle click, google... no luck.

candlejack
  • 1,189
  • 2
  • 22
  • 51
Trav L
  • 14,732
  • 6
  • 30
  • 39
  • 25
    @hobbs has the answer you are looking for! Right-click the top left corner of the window (the icon) select PROPERTIES and select "QUICK EDIT MODE" – BillyNair Jan 29 '14 at 03:21
  • 1
    I've seen is added but here's a link https://www.udacity.com/wiki/ud775/git-bash-copy-paste – laviku Dec 10 '14 at 01:20
  • 1
    Another usefull page: http://stackoverflow.com/questions/25267062/after-pasting-a-yanked-line-in-vim-why-cant-i-paste-it-again – Stanislav Jul 17 '15 at 02:34

36 Answers36

1069

Press Insert.

Also, to copy from the window, try clicking the console's window icon (topleft) and choosing Edit -> Mark, then drag a box on the text, then press Enter. (You can also paste via the window icon menu, but the key is faster.)

UPDATE

Starting from Windows 10 the CTRL + C, CTRL + V and a lot of other feature are implemented in conhost.exe so they should work with every console utility on Windows. (You have to enable Properties -> Option tab -> Quick Edit Mode)

Ref: http://blogs.windows.com/buildingapps/2014/10/07/console-improvements-in-the-windows-10-technical-preview/

Mwiza
  • 7,780
  • 3
  • 46
  • 42
Amber
  • 507,862
  • 82
  • 626
  • 550
  • 30
    What I want is to paste content `into` git bash. But thanks to you, I spotted `Edit -> Paste` which is exactly what I want! No more typing API code manually! – Trav L Feb 21 '10 at 01:08
  • Glad my answer helped, even if slightly circuitously. ;) – Amber Feb 21 '10 at 03:31
  • 27
    Strictly speaking, that's not msysgit's fault, but rather an issue because msys uses `cmd.exe`. – anarchivist Apr 17 '12 at 23:55
  • 1
    I upvoted your answer, but the fancy "Insert" key formatting initially made me miss the "Press Insert." part. – Danny Nov 26 '12 at 04:42
  • I'm not sure if this is also true in msysgit, but in git bash, using Edit->Mark->Enter copies line breaks or something. I was trying to create a new ssh key for bitbucket and using your suggestion gave me an "Invalid Key" message. So instead, I did cat ~/.ssh/mykeyfile > /c/Users/user/pub.txt and copied it from Notepad instead. Not saying your answer is wrong (actually it's perfectly correct and I upvoted it), but in case people run into copy/paste issues, I thought I'd mention this. – tandrewnichols Dec 16 '12 at 21:35
  • 1
    @tandrewnichols yes, Mark->Enter in the Windows terminal copies what's literally in the terminal, rather than being aware of lines. (Basically it comes down to Windows terminals being pretty dumb, sadly.) – Amber Dec 21 '12 at 14:44
  • 31
    Fuuuuuu, I am on mac running windows, I don't have INSERT – kevin Jun 24 '13 at 15:58
  • @KevinT you can use the "click on the console window icon" method then, it'll just be a little slower. – Amber Jun 24 '13 at 18:29
  • I too do not have an insert key! Why do they remove the ability to paste in bash?!? – BillyNair Jan 29 '14 at 03:07
  • @BillyNair You can still paste into Git Bash even without an Insert key - just use the menu method. – Amber Jan 29 '14 at 03:37
  • 40
    Thanks, btw on Win 7 I have to use `Shift + Ins`, otherwise it says something like `[(^2A](` and so forth. – henry Feb 24 '14 at 07:04
  • 1
    for folk using Parallels Desktop: add the shortcut of your liking in Preferences > Shortcuts > [your virtual machine]: I've set cmd+alt+i = insert – ptim May 19 '14 at 07:03
  • Shift-Insert required on Lubuntu as well. – DragonLord Jul 11 '14 at 01:11
  • @kevin and Mac users. Number Pad 0 is Insert on Windows. – Fadi Sep 30 '14 at 20:21
  • For those of you like me that have a Lenovo laptop without an Insert key, `Fn + i` will paste into the Git shell. – liamvictor May 14 '15 at 16:04
  • @Poma thanks, for me using Shift+FN+Enter allows me to paste into git bash while running in parallels. – Mike H-R May 20 '15 at 13:57
  • Starting from Windows 10 the Ctrl + C and Ctrl + V is implemented in conhost so it should work with every console utility on Windows. (You have to enable Properties -> Option tab -> Quick Edit Mode) – NoNameProvided Jul 30 '15 at 14:25
  • Anyone else dumb enough to look for an `Insert` option in the menu? I've never seen the keyboard markup before, and I don't think I've ever used to the Insert key as a Windows user on *purpose*. If not, I will gladly be your Village Idiot for the day, with scheduling flexibility. – kayleeFrye_onDeck Feb 05 '16 at 06:19
  • This also applies to mintty, although the remark about `conhost` obviously does not. Ctrl-V doesn't work in mintty and Shift-Insert is standard. – amoe Apr 27 '16 at 11:04
  • 1
    I am running Git Bash in Windows 10 using a Mac Keyboard... I have tried every keyboard shortcut suggestion on this list without success. – Jeremy Moritz Feb 21 '19 at 16:56
  • on Win 7 I used Win + Insert – Gleichmut Sep 19 '19 at 16:11
  • how come in 2021 apps still exist in which default key bindings are absent? – Gulzar Feb 28 '21 at 18:34
  • @Amber I downwoted you, because it does not work by only pressing Intert key. i had to press shift + Insert then it worked on win 10 pro!! – Farhad Ba-ali Sep 11 '22 at 09:50
  • Those instructions for changing the default didn't work for me. Instead I had to go into the Git Bash options: https://stackoverflow.com/questions/49142162/can-git-bash-shell-using-the-default-windows-shortcuts-for-copy-paste/61302661#61302661 – Nick S Nov 22 '22 at 22:30
146

Aside from using the edit menu commands, you can directly paste into the git bash window using the keyboard shortcut, Insert.

Pavel Chuchuva
  • 22,633
  • 10
  • 99
  • 115
Dan Rigby
  • 17,133
  • 6
  • 43
  • 60
  • 8
    No need for the Control key, just the Insert key works to paste – jasonpenny Mar 03 '10 at 02:11
  • how to cancel the paste? is there any shortcuts? Thanks! – Alex Chen Apr 25 '11 at 03:38
  • @Dan Rigby I am using latest msysgit at it doesn't work pasting. Triedied with bouth Menu->Paste and also hitting INSERT – Ghita Feb 01 '12 at 07:53
  • @Ghita it sounds like the content you want to paste isn't actually on the clipboard (or it's in a format that the shell doesn't understand). I verified locally with the latest version of msysgit that this is still functioning. – Dan Rigby Mar 07 '12 at 15:43
  • 2
    @AntiGameZ undo can be done with `Ctrl-_`. I believe this is all from readline utility, which emulates Emacs, the One True Editor. – Brady Trainor Feb 11 '14 at 01:35
  • This is toggling between insert and replace for me unfortunately in Ubuntu terminal. In order to paste I had to use Edit -> paste. – fIwJlxSzApHEZIl Nov 12 '14 at 01:45
  • Still not good usability - if I use my INSERT key to paste in the bash window, my keyboard is then on REPLACE, rather than INSERT, which requires that I press INSERT again. – Tim Hallman Dec 06 '14 at 18:17
68

It's not really a function of git, msys, or bash; every windows console program is stuck using the same cumbersome copy/paste mechanism for historical reasons. Turning on QuickEdit mode can help -- or you can install a nice alternative console like this one, and change your git bash shortcut to use it instead.

Community
  • 1
  • 1
hobbs
  • 223,387
  • 19
  • 210
  • 288
60

Copy:

Long-term solution: Click on Topleft icon > Defaults > Select "QuickEdit Mode" under "Edit Options" > Okay

Then select the text you want to copy. Press Enter

Short-term solution: Click on Topleft icon > Edit > Mark. Press Enter.

Paste:

Press Insert

(If the "QuickEdit Mode" is on, Right clicking might work too.)

Mwiza
  • 7,780
  • 3
  • 46
  • 42
HaoQi Li
  • 11,970
  • 14
  • 58
  • 77
  • 1
    This fixed it for me on Windows 7, after enabling QuickEdit Mode, I can use right click to paste :) – Mike R Sep 06 '13 at 03:45
  • +1 for the right-click as this works when using a windows VM with a mac keyboard – garyh Sep 09 '14 at 08:20
40

Use Shift + Insert like in linux bash

Edit: It works even in putty.

Anatoly Mironov
  • 7,356
  • 1
  • 26
  • 27
  • using `mintty 3.4.6`, quite late for this question but no need for `Ctrl`, `Insert` can do the job. – Luke Aug 02 '21 at 17:10
39

I'm back to Windows for the first time in a long time and this got me cursing like a docker. I finally found this:

ctrl_shift_letter_shortcuts

Enabling Ctrl+Shift+letter shortcuts got me to a Linux-like behaviour that has lowered my blood pressure. Ctrl+Shift+C/Vnow works.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
David Carboni
  • 1,556
  • 23
  • 24
  • 3
    I wish this would have worked for me, but it didn't. I can currently copy paste, but only using shift + insert and not the ctrl c/v or ctrl shift + c/v . tried other answers too :( – ansh sachdeva Sep 30 '20 at 20:36
21

The way I do this is to hold Alt then press Space, then E and finally P.

On Windows Alt jumps to the window menu, Space opens it, E selects Edit and P executes the Paste command.

Get these correct in succession and you can paste a snippet in under 2 seconds.

iKlsR
  • 2,642
  • 6
  • 27
  • 45
  • 1
    This is mac friendly too (works for those of us using Windows on a mac!) – Alex Jul 17 '14 at 12:32
  • Only works for English Windows. On a French OS it would be Alt + Space then M (_Modifier_) and finally O (_Coller_). – Gabriel Feb 16 '15 at 10:09
11

This is suggested by the github help page:

clip < filename

this copies the contents of filename to the clipboard and is useful for doing things like copying your id_rsa.pub to a web form.

Tim D
  • 1,645
  • 1
  • 25
  • 46
9

For paste in Git BASH CTRL + P

candlejack
  • 1,189
  • 2
  • 22
  • 51
Ehigie Paul
  • 122
  • 1
  • 7
9

enter image description here

In windows after this setting you can use ctrl + shift + v ( for windows)

Sanjib Debnath
  • 3,556
  • 2
  • 22
  • 16
7

Right click on the Git Bash shortcut and switch to the Options tab. Enable Quick Edit Mode and click OK.

Now you can use right click to paste into Git Bash, even passwords for remote push, which you can't do with Insert.

enter image description here

This also enables copy easily. Just left click and drag in the console window to select any block of text. Now right click on the selection and the text block will be copied in RAM. This is way more easier and intuitive than the other ways.

Image source: https://danlimerick.wordpress.com/2011/07/23/git-for-windows-tip-how-to-copy-and-paste-into-bash/

datasn.io
  • 12,564
  • 28
  • 113
  • 154
6

Windows:

  1. Right click
  2. Choose Options
  3. Choose Keys
  4. Enable Ctrl+Shift+letter shortcuts

How does it look like?

Alex MIr
  • 61
  • 1
  • 2
  • Not working for me (MINGW/GitBash on Win10), also how this should work if Ctl+C is already assigned? – elady Jul 27 '21 at 07:42
5

console2 ( http://sourceforge.net/projects/console/ ) is my go to terminal front end.

it add great features like copy/paste, resizable windows, and tabs. you can also integrate as many "terminals" as you want into the app. i personally use cmd (the basic windows prompt), mingW/msysGit, and i have shortcuts for diving directly into the python and mysql interpreters.

the "shell" argument i use for git (on a win7 machine) is:

C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"

xero
  • 4,077
  • 22
  • 39
5

Ctrl + insert did it for me in Windows.

candlejack
  • 1,189
  • 2
  • 22
  • 51
Patricia
  • 2,885
  • 2
  • 26
  • 32
4

You can also just right-click in the console window. Be sure (as per earlier answers) to enable both 'Edit Options' in the Properties panel (from the System menu).

John Kelleher
  • 411
  • 5
  • 7
4

if your intention is copy/paste comments for git commits, try set the enviromental variable EDITOR as your favorite plain-text editor (notepad, notepad++ ...) and when you will commit, don't give him the -m option and Git will open your favorite editor for copy/paste you comment

Lucas
  • 3,059
  • 5
  • 33
  • 48
4

Get Console2. You configure it to do it multiple different ways. Works with bash or Windows command prompts.

Jon Kruger
  • 4,009
  • 4
  • 33
  • 46
3

In the properties of the console you can activate the "Quick Edit Mode" under "Edit Options", that way you can paste inside the console just right clicking. Or you can use 'Insert' as they say.

epergo
  • 565
  • 5
  • 17
3

To copy select the text and click CTRL+INS

To paste place the cursor where you want to print

and click SHIFT+INS

For more options, on the top left click on git-bash icon

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
2

Yep, copy from somewhere else using ctrl+c and paste using INSERT. Work for me on Window 8.

candlejack
  • 1,189
  • 2
  • 22
  • 51
HoaPhan
  • 1,714
  • 1
  • 13
  • 35
2

enter image description here

  1. Right-click on the git bash.
  2. Select Options
  3. Click on the Mouse option on the left side bar.
  4. Select this highlighted option, it will be used as a paste.
  5. Don't worry, you can get the options when you do right-click on the top bar of the terminal.
  • Right mouse click after this configuration still triggers visual mode in VIM. holding shift key + right mouse click worked for me. – GO.exe Sep 20 '22 at 11:00
2

I was actually wondering how to do this today...and coincidentally, Phil Haack posted a tip about using posh-git (Git on powershell), which gives you tab auto-complete and a few more cool bits. I'm not going back to Git bash.

check it out

http://haacked.com/archive/2011/12/13/better-git-with-powershell.aspx

GR7
  • 5,083
  • 8
  • 48
  • 66
1

In windows I'm not sure about copy but for paste works Ctrl+Insert. In Linux copy: CTRL+SHIFT+C, paste: CTRL+SHIFT+V

Mwiza
  • 7,780
  • 3
  • 46
  • 42
1

I use the mouse:

  1. mark
  2. right click -> copy
  3. right click -> paste
Hind
  • 333
  • 3
  • 7
1

If you want to paste press:

shift + insert

0

COPY:Click the title bar, choose mark, then select the content you want to copy. PASTE: Copy what you want to past, focus on the bash, hit the insert key on the keyboard.

Lizzy
  • 1
0

For users working on Windows 7, Shift + INSERT works fine.

Abdullah Khan
  • 12,010
  • 6
  • 65
  • 78
0

I take it you're not on a Mac. Use insert key.

Buddy
  • 10,874
  • 5
  • 41
  • 58
HoaPhan
  • 1,714
  • 1
  • 13
  • 35
0

Here are a lot of answers already but non of them worked for me. Fyi I have a Lenovo laptop with win10 and what works for me is the following:


Paste = Shift+fn+prt sc


Copy = Shift+fn+c

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
Mik_A
  • 266
  • 5
  • 16
0

I also go through the same problem, git bash does not support tradition method to copy and paste in windows but you can simply copy and paste in single command

SHIFT+fn+INSERT

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
Avnish Nishad
  • 1,634
  • 1
  • 17
  • 18
0

If you click at the icon on the upper left corner, a drop-down menu will appear, and you can find the option to copy/paste from there.

mark
  • 1
0

on my keyboard insert is located on the same key as a Printscreen. unfortunately, ctrl + ins doesn't work for me , so i descoved the following working combinations for me:

FN + CTRL + PRT SC - for copy

FN + SHIFT + PRT SC - for insert

0

The solution that worked is for:

  • desktop keyboard: [shift] + [insert] keys to paste

  • laptop keyboard: [shift] + [0] keys to paste

NB: For laptops, the 0 Key at the bottom of the number pad on the upper-right corner of your keyboard will function as an Insert Key when Num Lock is turned off. That is why it is labeled with both 0 and Ins on the key itself.

-1

MacBook pro doesnt have an ins key. Use FN + ENTER to paste

Mwiza
  • 7,780
  • 3
  • 46
  • 42
Borune
  • 29
  • 5
-1

Just copy the link. Then press SHIFT + INSERT.

-1

For Windows 11 users- GitBash version 2.39.0.windows.2 (64-bit):

To copy it's: Ctrl + Insert

To paste it's: Shift + Insert

John Doe
  • 1
  • 3