我想sudo apt-get install git在我的 ubuntu 14.04 上安装 git 后安装 git。日志在这里:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package git is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
git-man
E: Package 'git' has no installation candidate
Run Code Online (Sandbox Code Playgroud)
然后,按照这个问题,我运行 git-core 而不是 git 但也失败了。顺便说一句我也尝试过apt-get update。
之后,我尝试了这个问题的答案。前面两条命令都没有问题,但是输入最后一条命令后,仍然出错。日志在这里: …
每当我尝试拉、推或克隆我删除代理但 git 仍然没有积极响应时,我的 git 就会卡住。
上次我使用此命令进行代理:
git config --global http.proxy 172.16.0.2:8080
Run Code Online (Sandbox Code Playgroud)
我尝试这些命令:
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global --unset core.gitproxy
Run Code Online (Sandbox Code Playgroud)
但当我克隆存储库或想要拉或推时仍然收到此响应!
badar:DSA Lab Tasks$ git clone https://github.com/badarshahzad/SEGP_Group10.git
Cloning into 'SEGP_Group10'...
fatal: unable to access 'https://github.com/badarshahzad/SEGP_Group10.git/': Failed to connect to 172.16.0.2 port 8080: Connection timed ou
Run Code Online (Sandbox Code Playgroud) 在终端中安装它会显示:
alexeya@RC530:~$ sudo dpkg -i gitkraken-amd64.deb
Selecting previously unselected package gitkraken.
(Reading database ... 239444 files and directories currently installed.)
Preparing to unpack gitkraken-amd64.deb ...
Unpacking gitkraken (4.0.5) ...
dpkg: dependency problems prevent configuration of gitkraken:
gitkraken depends on gconf2; however:
Package gconf2 is not installed.
dpkg: error processing package gitkraken (--install):
dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Errors were encountered while processing: …Run Code Online (Sandbox Code Playgroud) 我正在创建一个 bash 可执行文件,它创建一个 SSH 密钥,并将其上传到用户的 Gitlab 帐户。我知道如何通过 bash 可执行文件创建 SSH 密钥:
ssh-keygen -o -f ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
我也知道如何从中检索,但我不知道如何将其上传到用户的 Gitlab 帐户。
我找到了多个用于将用户的 SSH 上传到 Git hub 的文档,但没有找到 Gitlab(我认为大部分类似......?)。所以我会把它用于 Git hub
curl -u "USERNAME:PASSWORD" --data "{\"title\": \"TITLE\", \"key\": \"$(cat ~/.ssh/id_rsa.pub)\"}" https://api.github.com/user/keys
Run Code Online (Sandbox Code Playgroud)
我会制作USERNAME、PASSWORD和TITLE输入字段供用户自定义。
我想说,对于Gitlab来说也同样简单(我在他们的API网站POST /users/:id/keys上找到了,但不知道如何将其实现为命令),但我不知道Gitlab和Github的关系有多密切。curl
我不记得从哪里得到这段脚本,但我的.bashrc包含以下几行:
# set up autocomplete for git aliases
if [ -f "/usr/share/bash-completion/completions/git" ]; then
source /usr/share/bash-completion/completions/git
__git_complete gc _git_checkout
__git_complete gp _git_pull
else
echo "Error loading git completions"
fi
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
Run Code Online (Sandbox Code Playgroud)
gc和分别gp是git checkout和的别名git pull。
我有一个/usr/share/bash-completion-completions/git所以当我source ~/.bashrc没有任何回显到命令行。
在升级到 21.10 之前(21.04、20.04 和 18.04 工作正常),我可以gc feat<tab><tab>获取以 开头的分支列表feat,但现在在每个分支之后我都会收到一个奇怪的错误<tab>:
$ gc featbash: [: -lt: …Run Code Online (Sandbox Code Playgroud) [在此输入图像描述]
1无法连接到存储库:命令“git ls-remote -h -- git@github.com:yeni/jenkins-terraform.git HEAD”返回状态代码 128:stdout:stderr:没有 github 已知的 ECDSA 主机密钥。 com 并且您已要求严格检查。主机密钥验证失败。致命:无法从远程存储库读取。
请确保您拥有正确的访问权限并且存储库存在。
当我尝试将 GitHub 存储库与 Jenkins 连接时,出现此错误。让我知道如何解决
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Run Code Online (Sandbox Code Playgroud)
我试图在用户下执行一些 git 命令www-data,但它不起作用。
为了排除故障,我尝试运行sudo -u www-data git show但它返回fatal: detected dubious ownership in repository
如果我运行sudo -u www-data git diff --shortstat它会返回warning: Not a git repository. Use --no-index to compare two paths outside a working tree
我也尝试添加到sudoers
www-data ALL=(ALL) NOPASSWD: /usr/bin/git show
# and also
www-data ALL=(ALL) NOPASSWD: /usr/bin/git
Run Code Online (Sandbox Code Playgroud)
仍然遇到同样的错误。有什么想法吗?谢谢。
我正在将各种服务器的备份自动化到一个中心点,然后将这些配置更改推送到 git 存储库中,以便我可以跟踪随时间发生的任何更改。其余脚本运行良好,我可以通过网络将文件复制/同步到一个中心点。最后一个脚本是将配置文件放入/更新到存储库中。脚本如下:
#!/bin/bash
clear
SERVERNAME="betty"
SCRIPTDIR="/home/jon"
GITROOT="/tmp/git"
TEMPROOT="/tmp/backups"
BACKUPROOTDIR="/mnt/backups"
echo " - running as user: $UID"
echo "backingup git config on $SERVERNAME"
echo ""
# check to see if root backup folder exists, otherwise create it.
if [ -d $GITROOT ]; then
rm -rf $GITROOT
fi
mkdir $GITROOT
cd $GITROOT
echo " - testing if home is where I think it should be!"
echo $HOME
echo " - testing if it can see netrc"
tail $HOME/.netrc
git clone http://192.168.10.97:8000/repositories/HOH-config-backups.git …Run Code Online (Sandbox Code Playgroud) 我想安装一些 git 上的源代码。真的不知道那是什么意思;我以前从未使用过 git,但我认为是时候学习了,
我首先安装了git。
接下来我尝试克隆我要安装的软件的 git 目录。
我收到一条消息说“无法确定(IP)的真实性”。我继续前进并以另一条消息结束,“警告,将添加到已知主机中。” 我继续,它说了一些关于挂断连接的事情。
在互联网上搜索了一段时间后,我意识到我不需要 git 来安装软件,但现在我已经安装了它,并且已经将一些主机添加到某个文件或另一个文件中。我担心我创建了一些需要修复的安全问题。
任何人都可以帮助我撤消我所做的事情,或者更好地了解我所做的事情。添加 git 项目是否打开了我的系统?除此之外,谁能告诉我 git 是如何工作的。我发现的一切都假设我知道一些我还不知道的东西。
谢谢
我正在尝试meld在 Ubuntu上安装(我在 Windows 7 上使用 VirtualBox)以进行可视化git diff:
sudo apt-get install meld
Run Code Online (Sandbox Code Playgroud)
但是,它没有成功:
...
Get:9 http://au.archive.ubuntu.com/ubuntu/ oneiric/main python-pyorbit i386 2.24.0-6ubuntu1 [92.4 kB]
Get:10 http://au.archive.ubuntu.com/ubuntu/ oneiric/main python-gnome2 i386 2.28.1-3 [361 kB]
Get:11 http://au.archive.ubuntu.com/ubuntu/ oneiric/universe python-gtksourceview2 i386 2.10.1-2 [131 kB]
Fetched 1,310 kB in 6s (214 kB/s)
Failed to fetch http://au.archive.ubuntu.com/ubuntu/pool/main/p/pygtk/python-glade2_2.24.0-2_i386.deb Size mismatch
Failed to fetch http://au.archive.ubuntu.com/ubuntu/pool/universe/m/meld/meld_1.5.2-1ubuntu2_all.deb Size mismatch
Failed to fetch http://au.archive.ubuntu.com/ubuntu/pool/main/p/pyorbit/python-pyorbit_2.24.0-6ubuntu1_i386.deb Size mismatch
Failed to fetch http://au.archive.ubuntu.com/ubuntu/pool/main/g/gnome-python/python-gnome2_2.28.1-3_i386.deb Size mismatch
Failed to fetch http://au.archive.ubuntu.com/ubuntu/pool/universe/p/pygtksourceview/python-gtksourceview2_2.10.1-2_i386.deb Size mismatch
E: Unable …Run Code Online (Sandbox Code Playgroud)