标签: git-bash

如何在 Mac/OSX 中将预加载的 php 版本更改为 MAMP

我第一次使用 Mac/OSX,我已经安装MAMP并设置了 PHP 标准版本,7.1.6但是当我php -v在终端中运行命令时,我得到以下详细信息:

PHP 5.6.30 (cli) (built: Feb  7 2017 16:18:37) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Run Code Online (Sandbox Code Playgroud)

能否请您指导如何使用 7.1.6 版本而不是 5.6.30。

谢谢。

php macos git-bash

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

计算 git 项目中所有文件的所有修订

是否有一个 git 命令可以为项目中的每个文件输出类似这样或类似的内容:

20 file1
43 file2 etc.
Run Code Online (Sandbox Code Playgroud)

我很想知道每个文件被任何作者修改了多少次,而不仅仅是针对特定的作者。

git bash github git-bash

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

试图批量推送大量提交

我正在处理一个非常大的项目,需要从 Team Foundation Services 迁移到 Git。我成功执行了本地转换,获得了 2800 多个需要推送到 github 的提交。其中一些提交非常大,并且在返回以下错误之前,简单的 git push 获得了大约 3% 的结果:

fatal: pack exceeds maximum allowed size
Run Code Online (Sandbox Code Playgroud)

即将推出的包的大小似乎有大约 2.9GB 的限制。这似乎是合理的,所以我一直在 Stackoverflow 上搜索,看看如何推动这些提交。我切换到使用 SSH,但错误仍然存​​在,但后来我在评论中遇到了这行 GIT Bash 代码,该代码似乎针对我想要的(分批发送提交):

max=$(git log --oneline|wc -l); for i in $(seq $max -500 1); do echo $i; g=$(git log --reverse --oneline --skip $i -n1|perl -alne'print $F[0]'); git push gh $g:refs/heads/master; done
Run Code Online (Sandbox Code Playgroud)

挑战在于评论并没有真正提到这个命令是如何工作的,或者如何修改它以使其适合我的情况。我按原样运行代码并收到以下错误:

'gh' does not appear to be a git repository
Run Code Online (Sandbox Code Playgroud)

想我知道我在做什么我尝试以下 bash 代码的替代行:

max=$(git log --oneline|wc -l); for i in $(seq $max …
Run Code Online (Sandbox Code Playgroud)

git github git-bash

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

有没有办法将 git repo 合并到现有目录中?

我在 VSTS MyRepoX 中配置了一个 repo。这个 repo 只有一个自述文件。我有一个本地 VisualStudio 解决方案,我想将它包含在目录中,然后我需要确保这 2 个源对于推送和拉取是同步的。我可以采取哪些步骤来做到这一点?

git visual-studio git-bash azure-devops

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

Windows git bash 在调用 AWS CLI 时尝试将字符串解析为文件

我有一个 AWS SSM CLI 命令的字符串参数,由于以/. /path/to/my/param.

当我在 git bash 上运行命令时,它会尝试查找文件,无论我如何尝试转义它:

aws ssm get-parameter --name "/path/to/my/param"

aws ssm get-parameter --name '/path/to/my/param'

aws ssm get-parameter --name '\/path\/to\/my\/param'

An error occurred (ValidationException) when calling the GetParameter operation: Invalid label format /Program Files/Git/path/to/my/param. A label name can't be prefixed with numbers, "ssm", or "aws" (case-insensitive). You can specify letters, numbers, and the following symbols: period (.), dash (-), or underscore (_).

甚至尝试反引号,然后我收到一个 bash 错误

aws ssm get-parameter --name `/path/to/my/param`
Run Code Online (Sandbox Code Playgroud)

错误: bash: …

windows git-bash aws-cli

3
推荐指数
2
解决办法
822
查看次数

ssh-agent (PID 11108, closing is required)

Please help me close the following:
I want to uninstall git from my windows machine, and I cannot because of the following popup error message:

混帐

git uninstallation git-bash

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

如何使用 WinPTY 运行 npm 脚本?

在 Windows 上的 Git bash 中遇到了python 冻结的已知问题。stackoverflow 上的许多答案都建议使用WinPTY

当我使用时,它工作正常:

winpty python foo.py

但是我将 python 程序作为 npm 脚本的一部分运行。我的 package.json 有这个:

"scripts": {
  "start": "python foo.py && something else"
} 
Run Code Online (Sandbox Code Playgroud)

所以我想我也需要用 WinPTY 运行 npm 脚本:

winpty npm start

但这是行不通的。我在不同的环境中收到了不同的错误消息。

  1. 我在安装了最新的 git 和 npm 的工作中遇到了“在 PATH 中找不到”,但在 PATH 中:

winpty:错误:无法启动“npm”:在路径中找不到

  1. 我在我的个人电脑上用一个稍微旧的 git 遇到了一个不同的错误:

错误 0x2 启动 npm start

任何想法为什么 npm 和 winpty 不能一起工作?

如果我在npm start没有 winpty 的情况下运行它可以正常工作。winpty node也有效。

windows npm git-bash

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

Visual Studio Code cannot detect installed git AND 'error launching git: The filename or extension is too long.'

I have looked at most of the posts describing the first error on the title : "Visual Studio Code cannot detect installed git".

Nevertheless, I believe that the second error "error launching git: The filename or extension is too long." generates the first one.

Could you help me?

  1. Git works while using "Git Bash"
  2. VS Code indicates that git not found. install it or configure it using 'git.path' 找不到 vscode git。 使用“git.path”安装或配置它
  3. VS Code indicates that VSCODE : no source control providers registered …

git git-bash visual-studio-code vscode-settings

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

如何在 Windows 上安装 bash bc 以及在哪里安装

我不知道在 Windows 上如何安装以及在哪里安装 bc

 $ bash -help
 GNU bash, version 4.4.23(1)-release-(x86_64-pc-msys)

 $ bc
 bash: bc: command not found
Run Code Online (Sandbox Code Playgroud)

我在 Windows 上使用 git-bash / mingw64。

请帮忙

bash git-bash

3
推荐指数
2
解决办法
5813
查看次数

Bash 将命令输出与字符串进行比较

输出相同,并且总是 echo need to pull。如果我删除条件周围的引号$textif则会引发too many arguments错误。

var="$(git status -uno)" && 

text="On branch master Your branch is up-to-date with 'origin/master'. nothing to commit (use -u to show untracked files)"; 

echo  $var; 
echo  $text; 
if [ "$var" = "$text" ]; then
    echo "Up-to-date"
else
    echo "need to pull"
fi

Run Code Online (Sandbox Code Playgroud)

bash git-bash

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