简体   繁体   English

Vagrant:如何在运行 Vagrant ssh 时在 Windows 命令窗口中粘贴文本

[英]Vagrant: How to paste text in Windows command window, when running Vagrant ssh

How can I copy and paste stuff into Windows command window, which runs Vagrant ssh in it?如何将内容复制并粘贴到运行 Vagrant ssh 的 Windows 命令窗口中? Right mouse button is then somehow blocked然后鼠标右键以某种方式被阻止

The windows terminal is awful. Windows 终端很糟糕。 To paste, what you need to do is right-click the top-left corner of the window (where the icon is), go down to edit, and select "Paste".要粘贴,您需要做的是右键单击窗口的左上角(图标所在的位置),向下编辑,然后选择“粘贴”。 No keyboard shortcuts for it.没有键盘快捷键。

Now, one alternative is to connect to your vagrant VM with something like Putty.现在,一种替代方法是使用 Putty 之类的东西连接到你的流浪虚拟机。 Just connect to localhost on port 2222. username is "vagrant" but you will need to take a few steps to convert the SSH key for login.只需在端口 2222 上连接到 localhost。用户名是“vagrant”,但您需要采取一些步骤来转换 SSH 密钥以进行登录。 Here is an article explaining what you need to do. 是一篇文章,解释了您需要做什么。

An easiest shortcut would be:最简单的捷径是:

1) Go to your vagrant vm 1)去你的流浪虚拟机

-> vagrant ssh -> 流浪 ssh

2) Set password to your vagrant user 2)为你的流浪用户设置密码

sudo passwd vagrant须藤通行证无业游民

Enter new UNIX password: 12345输入新的 UNIX 密码:12345

Retype new UNIX password: 12345 passwd: password updated successfully重新输入新的 UNIX 密码:12345 passwd:密码更新成功

3) Login using Putty : 3) 使用 Putty 登录:

Host name: localhost Port: 2222 (or your vagrant vm mapped ssh port)主机名:localhost 端口:2222(或者你的 vagrant vm 映射的 ssh 端口)

username: vagrant用户名:流浪

password: 12345密码:12345

Enjoy!享受!

Supplement.补充。 I use the git ssh key for ssh.(I use the laravel homestead)我使用 git ssh 密钥进行 ssh。(我使用 laravel homestead)

So when load the key in putty key generator, you should choose the git ssh private key.所以在 putty 密钥生成器中加载密钥时,您应该选择 git ssh 私钥。

On Windows 10:在 Windows 10 上:

  1. Right-click on the terminal menu title.右键单击终端菜单标题。
  2. Click Properties单击Properties
  3. Check Options > Edit Options > Use Ctrl+Shift+C/V as Copy/Paste检查Options > Edit Options > Use Ctrl+Shift+C/V as Copy/Paste

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM