无法选择樱桃挑选(FETCH),但能够拉动&推入Gerrit Git

时间:2012-11-24 08:02:08

标签: git gerrit

正如我在标题中所说,我能够推动细菌,从细菌中拉出来,但我无法挑选。当我问管理员时,他说我拥有樱桃选择的所有权利,但我收到的错误是:

错误消息

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

当我尝试Pull and Rebase

praveen@praveen-vbox:~/work/myapp$ git pull --rebase
remote: Counting objects: 8888, done
remote: Finding sources: 100% (615/615)
remote: Total 615 (delta 416), reused 536 (delta 416)
Receiving objects: 100% (615/615), 267.47 KiB, done.
Resolving deltas: 100% (416/416), completed with 163 local objects.
From gerrit:myapp
   b7b8734..f5a782b  master     -> origin/master
First, rewinding head to replay your work on top of it...
Fast-forwarded master to f5a782b97079491e25638c9a752794e3af0a7543.

当我尝试检查状态时

praveen@praveen-vbox:~/work/myapp$ git status
# On branch master
nothing to commit (working directory clean)

当我尝试提交

praveen@praveen-vbox:~/work/myapp$ git commit
[master 4c41a43] Minor fixes
 2 files changed, 2 insertions(+), 2 deletions(-)

当我尝试按

praveen@praveen-vbox:~/work/myapp$ git push gerrit:myapp HEAD:refs/for/master
Counting objects: 20, done.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 896 bytes, done.
Total 10 (delta 9), reused 0 (delta 0)
remote: Resolving deltas: 100% (9/9)
remote: Processing changes: updated: 1, done
To gerrit:myapp
 * [new branch]      HEAD -> refs/for/master

当我尝试Cherry Pick

praveen@praveen-vbox:~/work/myapp$ git fetch ssh://praveen@my.appdomain.com:29418/myapp refs/changes/24/5324/2 && git cherry-pick FETCH_HEAD
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

摘要

我的应用程序在 VirtualBox 实例上的 Ubuntu 12.04 上运行。我的所有同行都可以cherry-pick,我发现问题仅适用于我的机器,cherry-pick也适用于 FETCH 。可能是什么问题?你们有什么建议?你还需要除此之外的哪些信息?


更新#1

Git Config

praveen@praveen-vbox:~/work/myapp$ git config --list
alias.s=status
alias.c=commit
alias.ca=commit --amend
alias.co=checkout
alias.dc=diff --color
alias.l=log --oneline
alias.pr=pull --rebase
alias.aa=add .
user.email=[removed] /* Removed before posting to SO. Email matches. */
core.editor=vim
color.ui=always
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=gerrit:myapp.git
branch.master.remote=origin
branch.master.merge=refs/heads/master

对于Titas的查询,结果为:

praveen@praveen-vbox:~/work/myapp$ git fetch gerrit refs/changes/96/5396/3
fatal: 'gerrit' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

此外,当我正常时,结果如下:

praveen@praveen-vbox:~/work/myapp$ git fetch ssh://praveen@my.appdomain.com:29418/myapp refs/changes/96/5396/3 && git cherry-pick FETCH_HEAD
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

更新#2:SSH配置

根据RasmusØstergaardKjærVoss的要求,我在SSH Config文件中包含了以下内容。如果有什么需要改变,请告诉我。

praveen@praveen-vbox:~/work/myapp$ cat ~/.ssh/config
Host gerrit
HostName my.appdomain.com
Port 29418
User praveen
IdentityFile ~/.ssh/praveen_private

3 个答案:

答案 0 :(得分:1)

我的理解~/.ssh/ git fetch ssh://praveen@my.appdomain.com:29418/将使用id_rsa密钥,而不是~/.ssh/praveen_private

备份您的~/.ssh文件夹然后尝试创建名为~/.ssh/praveen_private的{​​{1}}副本如果是~/.ssh/id_rsa密钥,则将其复制到rsa

干杯

答案 1 :(得分:0)

您在git或gerrit中的设置或gerrit部署的整体设置有问题。您可以运行git pull,它基本上运行git fetch && git merge。但是你无法运行从gerrit复制粘贴的git fetch命令。查看git remote -v的输出,并将其与您尝试运行的cherry-pick命令的git fetch部分进行比较。您是否使用完全相同的服务器URL&港口?作为同一个用户?

最后,作为对Gerrit的连接测试,请尝试运行类似ssh username@gerrit_host -p 29418 gerrit ls-projects的内容。这应该返回Gerrit服务器上的项目列表,这是解决任何设置问题的好方法。

答案 2 :(得分:0)

这给了我同样的错误:

ssh firstname.lastname@my.appdomain.com

更改为:

ssh firstname.lastname@gerrit.appdomain.co

为我解决了这个问题。