我正在尝试将新文件添加到我的工作目录中,然后通过执行以下操作来注册它们:
git add filename.php
Run Code Online (Sandbox Code Playgroud)
昨天我刚刚仔细检查了远程 gitlab 位置,昨天的所有新文件都已包含在内。
但是,现在每当我添加新文件时,我都会收到此错误:
pathspec filename.php didn't match any files
Run Code Online (Sandbox Code Playgroud)
如果我这样做git status,则确认新文件没有被注册。
ls- 新文件未显示,尽管它们实际上位于特定文件夹中。
我没有gitignore对此事进行任何更改或任何其他设置,并且我已经仔细检查我是否位于正确的文件夹和正确的分支上。
尝试使用 git 克隆存储库时出现以下错误:
Fatal: Unable to checkout working tree
warning: Clone succeeded, but failed checkout.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
Run Code Online (Sandbox Code Playgroud)
此外,多个文件中出现以下消息:“错误:无法创建文件”
https://i.stack.imgur.com/QIBr3.png
通过使用“git status”命令,我看到许多文件被标记为已删除[实际上文件仍然存在]
https://i.stack.imgur.com/RX36z.png
我按照git checkout -f HEAD第一个错误中的要求使用了命令,但结果如下
所以,我复制了它。运行:git ls-files|grep navbar.html|xargs vim
在我的Git Bash和退出的 vim 中,使我Git Bash不再接受键盘输入。不过我的其他Git Bash窗口工作正常。
我有什么想法可以解决这个问题吗?
我之前使用 git bash 作为本地存储库。
我已连接到 GitHub 帐户,并且总是毫无问题地推送我的文件。
后来,我卸载了 bash 并使用新用户和电子邮件重新安装。现在,当我尝试将文件推送到远程时,出现错误:
Permission to SyedMiraj/SpringSecurityWithTicketBooking.git denied to biid-sua.
unable to access 'https://github.com/SyedMiraj/SpringSecurityWithTicketBooking.git/': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)
我尝试创建一个新的 SSH 密钥并将其添加到远程存储库中。
但问题仍然存在,说实话我无法将任何东西推送到我的遥控器上。
我的两个 GitHub 帐户是 biid-sua 和 smiraj。
您建议如何恢复 GitHub 推送?
是否有从当前分支拉取而不显式调用它的快捷方式。
例如我已经检查了一个分支:git checkout mybranch
要从我使用的分支中拉取git pull origin mybranch。是否可以跳过该origin mybranch部分?问题是,我们的分支有很长的名称,例如b_searchsystem_grid.
也许类似于git pull origin .(. 对于当前分支)。
我在 Windows 7 环境中使用 git bash。我启动 git bash 并输入git config --list,但之后我无法运行任何命令,并且 git bash 仅显示(end)在屏幕中。我不知道发生了什么,该命令之前工作正常。
截图:


我在 Windows 10 中使用 GitBash,并希望在 child_process.exec 调用中执行 git 命令。我认为,由于我通过“Git For Windows”安装了 git,因此我只需将 shell 指定为 GitBash 可执行文件即可。我已经尝试了我能想到的 GitBash 可执行文件路径的所有变体,但总是失败。节点正在寻找的路径是什么?
无效路径示例
c:/program files/git/usr/bin/bash
c:/program\ files/git/usr/bin/bash
/c/program\ files/git/usr/bin/bash
c:\\program files\\git\\usr\\bin\\bash
const { expect } = require('chai');
const { exec } = require('child_process');
describe.only('exec', function(){
it('should work', function(done){
let shellPath = "c:\\program files\\git\\usr\\bin\\bash";
expect(exec(`cat <<< "abc"`, { shell: shellPath }, (err, stdout) => {
expect(err).to.be.null;
expect(stdout.trim()).to.be.equal("abc");
done();
}));
});
});
Run Code Online (Sandbox Code Playgroud)
第一个断言失败并显示:
expected [Error: Command failed: cat <<< "abc" << was unexpected at this time.] …Run Code Online (Sandbox Code Playgroud) 认为我在远程有 50 个提交,在创建合并请求之前,我想删除所有 49 个提交并仅保留我推送的最后一个。
有没有办法做到这一点?
在 Windows 10 上,我安装了 Visual Studio Code。
当我打开终端 (Git Bash) 并输入 时less-watch-compiler,出现错误:
分段故障
但是,如果我转到 Git Bash 终端本身(在 Visual Studio Code 之外)并输入less-watch-compiler,该命令就会起作用。
我该如何解决这个问题?
我重新安装了 Windows 版 Git,但没有帮助。
我有最新版本的 Visual Studio Code (1.36.1)
当我在 Visual Studio Code 中使用“cmd”编辑器时,它也工作得很好。
我注意到我在 GitBash 中创建的 virtualenv 没有使用 venv 的 python/pip 可执行文件,并且 pip 正在尝试将东西安装到系统站点包中。我确信上次检查时它工作正常,所以我不确定出了什么问题/出了什么问题,但这让我感到困惑,因为从角度来看我已经做了所有正确的事情。
我错过了什么?
我的重现步骤非常简单:
chris@windows-pc MINGW64 ~
$ which python
/c/Program Files/Python37/python
chris@windows-pc MINGW64 ~
$ which pip
/c/Program Files/Python37/Scripts/pip
chris@windows-pc MINGW64 ~
$ python -m venv /c/venvs/test
chris@windows-pc MINGW64 ~
$ . /c/venvs/test/Scripts/activate
(test)
chris@windows-pc MINGW64 ~
$ which python
/c/Program Files/Python37/python
(test)
chris@windows-pc MINGW64 ~
$ which pip
/c/Program Files/Python37/Scripts/pip
(test)
chris@windows-pc MINGW64 ~
Run Code Online (Sandbox Code Playgroud)
我已尝试使用上述命令和.,source并且行为是相同的。
git-bash ×10
git ×6
github ×4
windows ×4
windows-10 ×2
command-line ×1
gitlab ×1
node.js ×1
python ×1
python-3.x ×1
ssh ×1
virtualenv ×1