Git working over http but not ssh

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have a remote repository that is working fine when I communicate over http, but if I use ssh it gives me errors when trying to push.

Goal: get the repo to work over ssh

I can ssh directly into the remote machine without problem, all folders and files in the git repo and git working directory have 771 permissions, the owner is apache and group is test (which the user I m ssh-ing with test is a member of). I also tried changing the owner and group to test , but that didn t help. I ve confirmed the user account is able to read/write/execute from the git directories via ssh.

I have a non-standard directory setup due to using virtualmin:
/home/test (user home)
/home/test/public_html (web root)
/home/test/public_html/git (gitweb directory)
/home/test/public_html/git/git.git (repo directory)

This causes the same error message as below (no such file or directory) when I do any git commands locally (directly on the remote server) unless I specify --git-dir and --work-tree, however, since http is working and pushing to the remote server shouldn t need to know the remote working directory, I don t see how this would be the issue (and also don t see how to fix it if it was).

Also, if it s relevant, I m using password authentication rather than keys.

Does anyone have thoughts on how I can solve / further diagnose this issue?

The error

git push origin:

Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 309 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
error: unable to create temporary sha1 filename ./objects/1d: No such file or directory

fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To test@test.local:/home/test/public_html/git/git.git/
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to  test@test.local:/home/test/public_html/git/git.git/ 

More info

http://test@test.local/git/git.git/ http://test@test.local/git/git.git/

Password: 
Password: 
Fetching remote heads...
  refs/
  refs/heads/
  refs/tags/
updating  refs/heads/master 
  from 425f5c3810b1c9e4ecc7ee7df3cd1bb8818b2115
  to   65d2358df3035689116339a14f504f34a6212a27
    sending 3 objects
    done
Updating remote server info
To http://test@test.local/git/git.git/
   425f5c3..65d2358  master -> master
 (I m a bit confused why there s so much difference between http and ssh here; the http asks me my password twice and then starts fetching remote heads, whereas the ssh asks me my password once and then starts counting objects.)  

git pull origin:

Already up-to-date

git remote show origin:

* remote origin
  Fetch URL: test@test.local:/home/test/public_html/git/git.git/
  Push  URL: test@test.local:/home/test/public_html/git/git.git/
  HEAD branch: master
  Remote branches:
    master  tracked
    release tracked
  Local branches configured for  git pull :
    master  merges with remote master
    release merges with remote release
  Local refs configured for  git push :
    master  pushes to master  (fast-forwardable)
    release pushes to release (up to date)

And if it s of any use, my local config file:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = test@test.local:/home/test/public_html/git/git.git/
[branch "master"]
    remote = origin 
    merge = refs/heads/master
[branch "release"]
    remote = origin
    merge = refs/heads/release

And remote config file:

[core] 
   repositoryformatversion = 0
   filemode = true
   bare = false
   worktree = /home/test/public_html
   sharedRepository = true

  Further investigation   

After Jan s comments I investigated the problem a bit further. I was assuming only the test account would be used during push over ssh (and apache used over http push), but I think it must be both.

I ve gone back through the non-working repo and set the ownership the same as in the working repo (some files/folders are apache.test, others are test.test, and the config file is root.test).

I haven t checked absolutely everything, but the files in the repo dir, and all files and folders under objects, refs and info all have identical ownership and permissions in both the working and non-working, and the user accounts are set up in the same way (I did try 777 in my troubleshooting previously).

The main difference I can think of is that in the the non-working repo, I started using http and then switched to ssh, whereas in the working repo I went directly to using ssh and the repo was empty before that. Perhaps there s an odd file somewhere with wrong permissions that s breaking everything, or there s something bizarre going on inside the actual files that I ve upset by using different protocols, or maybe it s just got corrupt due to my hours of trying to get it to work yesterday.

Answers

I set up a brand new remote repository under a different user account and it s now working fine. All settings are the more or less the same (permissions are less strict this time), so I m not sure what the issue was.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/7586093/git-working-over-http-but-not-ssh

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils