我正在使用windows cmd上的git命令处理远程存储库,它工作得很好,但当在git bash终端中使用git命令时,我得到了错误:
Your configuration specifies to merge with the ref 'refs/heads/feature/branch-name'
from the remote, but no such ref was fetched.
如何修复git bash终端?
我非常不擅长shell脚本(使用bash),我正在寻找一种方法来检查当前的git分支是否为"x",如果不是"x“,则中止脚本。
#!/usr/bin/env bash
CURRENT_BRANCH="$(git branch)"
if [[ "$CURRENT_BRANCH" -ne "master" ]]; then
echo "Aborting script because you are not on the master branch."
我正在尝试使用带有GIT和openSSH的Windows10上的亚马逊网络服务CodeCommit。我可以成功地连接到Putty,但我不想使用它。我在~/.ssh/id_rsa中创建了一个密钥,并将其上传到AWS控制台。因此,如果我尝试在GitBash中连接ssh,它就不会起作用。
$ ssh git-codecommit.us-east-1.amazonaws.com
You have successfully authenticated over SSH.
You can use Git to interact with AWS CodeCommit.
Interactive shel
我在Git For Windows (以前称为msysgit) 1.7.10.msysgit.1上运行Git扩展2.32。
另一个用户创建了一个新分支,并将其推送到远程存储库。我想将这个新分支获取到我的本地存储库。
显示了我正在尝试做的事情。主服务器当前已签出,另一个用户添加了一个新的分支"brentfo",他已将其推送到远程存储库。现在,我想将这个新分支获取到我的本地存储库。
我打开Git扩展拉入对话框,如图所示。我选择了新的远程分支"brentfo“,选择了合并选项”不合并,只获取远程更改“。当我点击Pull按钮时,我会看到一个进度对话框:
c:\Program F
我有一个bash脚本,它接受分支名称(例如,"master“或"feature/foo")或提交散列(例如,"1234abcd")的字符串。
我已经签出了存储库,所以我可以调用git。
确定字符串是分支名称还是提交散列的最佳方法是什么?
#!/bin/bash
commit_or_branch="$1"
cd /path/to/my_repo
git fetch
if <is_branch $commit_or_branch>
then
echo "it's a branch"
else
我有一个我似乎解决不了的奇怪问题。以下是所发生的事情:
我在github存储库中有一些我不想要的日志文件。我发现这个脚本可以从git历史记录中完全删除文件,如下所示:
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of
假设我运行:
git push
然后我得到了错误消息:
fatal: The current branch cdt-rd has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin cdt-rd
有没有办法让我的git或bash自动将正确的命令(git push --set-upstream origin cdt-rd)复制到我的剪贴板上?