我有一个 git repo,我通常通过我的 mac 笔记本电脑处理它。我之前也在我的 Windows 笔记本电脑上克隆了 repo(使用git bash和cygwin),一切都很好,但是今天当我拿了一个时,虽然我的 Windows 笔记本电脑没有本地更改,但git pull我得到了几个merge conflicts。
我认为可能是 mac 中的文件夹使用/(正斜杠)和 windows 中的文件夹\(反斜杠),但我不确定。
谁能告诉我为什么会发生这种情况以及如何解决这个问题?
我正在关注GitHub 的使用 API的教程。在我的 Git Bash 命令提示符中,我输入以下内容
curl -i https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
这会像预期的那样引入 JSON。但是,当我输入
curl -i -u your_username https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
它只是打印一个新行,好像在等我完成命令什么的。我需要按下CTRL C才能逃脱。我也尝试过不同的变体,
curl -i -u "your_username" https://api.github.com/users/defunkt
curl -i --user your_username https://api.github.com/users/defunkt
curl -i --user "your_username" https://api.github.com/users/defunkt
curl -i -user your_username https://api.github.com/users/defunkt
curl -i -user "your_username" https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
没有任何效果。我究竟做错了什么?
我在Windows下使用git bash,我想制作一个git alias命令,其概念上是这样的:
[alias]
assume_unchanged_below = "!git ls-files -z $dir | xargs -0 git update-index --assume-unchanged"
Run Code Online (Sandbox Code Playgroud)
其中$dir扩展到git assume_unchanged_below执行的bash shell中的当前工作目录.
即如果我进入C:\somedir\somesubdir并执行,git assume_unchanged_below我会希望它就像我打字一样git ls-files -z C:\somedir\somesubdir | xargs -0 git update-index --assume-unchanged
似乎可以通过获取当前目录git rev-parse --show-prefix.我也知道可以使用匿名函数传递参数,但我无法将这两个概念结合起来以获得我想要的行为.
例如,如果我这样做:
[alias]
assume_unchanged_below = "!f() { \
git ls-files -z $1 | xargs -0 git update-index --assume-unchanged; \
}; f"
Run Code Online (Sandbox Code Playgroud)
然后我可以输入
git assume_unchanged_below `git rev-parse --show-prefix`
Run Code Online (Sandbox Code Playgroud)
它的行为与预期一致($1正确扩展到当前工作目录).
但是,我不想手动传递git rev-parse --show-prefix给别名,我希望它自动推断,这样我只需要输入
git assume_unchanged_below …Run Code Online (Sandbox Code Playgroud) 我正在尝试devenv从 Windows 上的 Git Bash 中运行。devenv接受诸如/build Debugor 之类的参数/projectconfig Debug。写作
devenv MySolution.sln /build Debug /project MyProj/MyProj.csproj
Run Code Online (Sandbox Code Playgroud)
失败,并devenv认为/build是当前文件夹中的一个文件。
另一方面,
devenv MySolution.sln --build=Debug --project=MyProj/MyProj.csproj
Run Code Online (Sandbox Code Playgroud)
也失败了。
如何从 Git Bash 中正确传递参数?
我在 ~/.bash_profile 中设置了一个别名,如下所示:
alias lcmt="git show $(git log --oneline | awk '{print $1;}' | head -n 1)"
但是,每当我打开终端窗口时,我都会看到:
fatal: Not a git repository (or any of the parent directories): .git
我已经能够将其缩小到该特定别名,因为当我将其注释掉时,没有错误消息。为什么它在 OS X 上自行评估?我可以阻止它这样做吗?
我已经配置了我的核心编辑器,一切正常。我可以在我的编辑器中从命令行打开任何文件。
但是,当我到达 'git commit' 时,我收到了这个错误:
hint: Waiting for your editor to close the file... fatal: cannot run --
unset-all: No such file or directory
error: unable to start editor '--unset-all'
Please supply the message using either -m or -F option.
Run Code Online (Sandbox Code Playgroud)
我首先尝试使用 Sublime,而不是 Brackets 和 Atom。我什至尝试重置 .gitconfig ( rm ~/.gitconfig) 并且没有任何改变。
有什么命令可以修复这个错误吗?还是我必须卸载git?
ls -la并且ls -l都提供比ls命令更多的信息。但是,由于它们的输出非常相似,我不清楚这两个命令之间的区别是什么。
ls -la和ls -lgit bash 有什么区别?
我正在尝试使用 Git-Bash 在 Windows 中激活虚拟环境我使用了这一行,这工作正常
virtualenv project1_env
Run Code Online (Sandbox Code Playgroud)
然后当尝试这条线激活
.\project1_env\Scripts\activate
Run Code Online (Sandbox Code Playgroud)
我得到了 bash: .project1_envScriptsactivate: command not found 我尝试了几次尝试使其正常工作,但没有
请注意,此行在命令提示符下运行没有问题 所以我的问题是在 Windows 上使用 Git-Bash
感谢先进的帮助
我使用的是 Windows 10。当我输入命令“git add”时。在我的 Git Bash 中,我不断收到此消息,如下所示:
warning: could not open directory 'AppData/Local/Application Data/': Permission denied
warning: could not open directory 'AppData/Local/ElevatedDiagnostics/': Permission denied
warning: could not open directory 'AppData/Local/History/': Permission denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/INetCache/Content.IE5/': Permission denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/Temporary Internet Files/': Permission denied
warning: could not open directory 'AppData/Local/Temporary Internet Files/': Permission denied
warning: could not open directory 'Application Data/': Permission denied
warning: could not open directory 'Cookies/': Permission denied
warning: could not …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用缩短我的bash提示的功能。我已将其添加到.bash_profile:
function last_two_dirs {
pwd |rev| awk -F / '{print $1,$2}' | rev | sed s_\ _/_
}
export PS1='$(last_two_dirs) $(__git_ps1) ? '
Run Code Online (Sandbox Code Playgroud)
但是bash: rev: command not found每次启动git bash时都会出错。
我设置PATH正确,因为除以外的其他命令都能正常工作rev。是rev不是git bash的一部分?还是有其他方法仅显示bash提示的父目录和当前目录?
作业系统:Windows 10
git-bash ×10
git ×5
bash ×3
windows ×3
shell ×2
alias ×1
command-line ×1
curl ×1
cygwin ×1
git-alias ×1
github ×1
github-api ×1
macos ×1
python ×1
virtualenv ×1