标签: git-bash

是否可以使用 Git Bash 在 Windows 10 上建立 SSH 隧道?

我正在尝试将端口 5000 从本地计算机转发到远程服务器的端口 5000

我正在使用命令

ssh -L 5000:localhost:5000 root@remote
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试在本地计算机上发出以下 curl 请求时

curl http://172.19.0.2:5000
Run Code Online (Sandbox Code Playgroud)

它超时,而相同的命令在远程机器上工作。

有什么我遗漏的或者这可能在 Windows 上吗?

windows ssh git-bash

4
推荐指数
1
解决办法
4650
查看次数

Windows 终端添加 git-bash 始终在新终端窗口中打开

我能够弄清楚如何在 Windows 终端中集成 Git-Bash,但是当我选择它时,它总是在 Windows 终端的新窗口中打开。个人资料如下,姓名已删除。

 {
    "tabTitle": "Git Bash",
    "acrylicOpacity": 0.5,
    "background": "#012456",
    "closeOnExit": true,
    "colorScheme": "Campbell",
    "commandline": "\"C:\\Program Files\\Git\\git-bash.exe\" --cd-to-home",
    "cursorColor": "#FFFFFF",
    "cursorShape": "bar",
    "fontFace": "Consolas",
    "fontSize": 10,
    "guid": "{<some guid>}",
    "historySize": 9001,
    "icon": "C:\\Users\\<user>\\Pictures\\gitbash.png",
    "name": "Git Bash",
    "padding": "0, 0, 0, 0",
    "snapOnInput": true,
    "startingDirectory": "C:\\Users\\<user>",
    "useAcrylic": true
  },
Run Code Online (Sandbox Code Playgroud)

git-bash windows-terminal

3
推荐指数
1
解决办法
2438
查看次数

如何获取我运行命令的目录名称

我有一个这样的文件夹C:\repos\3333-new-feature。从该位置,在 git bash 终端中,我运行一个 bat 文件:

/c/repo/3333-new-feature
$ myBat.bat
Run Code Online (Sandbox Code Playgroud)

bat 中的指令之一应使用目录名称,如下所示:

git flow feature start 3333-new-feature
Run Code Online (Sandbox Code Playgroud)

如何创建一个仅是当前目录名称的变量?例如git flow feature start %currentDirectory%

batch-file git-bash

3
推荐指数
1
解决办法
3135
查看次数

Git Bash 在 Windows 上启动极其缓慢

我读过与此类似的帖子;看来我的问题有所不同。

我怀疑我遇到这个问题是因为我,.bash_profile因为当我删除它并再次打开终端时,它会快速启动,并且显示:

WARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile.

This looks like an incorrect setup.
A ~/.bash_profile that loads ~/.bashrc will be created for you.
Run Code Online (Sandbox Code Playgroud)

生成.bash_profile

# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
Run Code Online (Sandbox Code Playgroud)

.bashrc

if [ -t 1 ]; then
exec zsh
fi
Run Code Online (Sandbox Code Playgroud)

我的环境变量中还有一个 HOME 变量。

windows .bash-profile git-bash

3
推荐指数
1
解决办法
3927
查看次数

Git-Bash 未按预期运行 Python3,挂起问题

我将尽量描述性但尽可能简短......

过去我一直在 Win10 上成功使用 GitBash。我在一段时间不使用它之后又回到了我的 Windows 机器上,似乎无法让它启动以前没有问题运行的 python 脚本。我为 Python3 创建了一个别名,名为 py。例如...

$ py --version
Python 3.7.1
Run Code Online (Sandbox Code Playgroud)

我可以很好地进入迭代器

$ py -i
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Run Code Online (Sandbox Code Playgroud)

我可以在迭代器中很好地运行我的脚本。但是,使用 ctrl+z 退出会引发错误。结合此错误,当我尝试从命令行运行 scipts 时,它挂起并且没有响应。见下文...

$ py -i
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>       0 [sig] bash …
Run Code Online (Sandbox Code Playgroud)

linux python python3 git-bash windows-10

2
推荐指数
1
解决办法
6177
查看次数