Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging pull requests on repository with LFS not working #4463

Closed
2 of 7 tasks
severgun opened this issue Jul 18, 2018 · 28 comments
Closed
2 of 7 tasks

Merging pull requests on repository with LFS not working #4463

severgun opened this issue Jul 18, 2018 · 28 comments
Labels
issue/duplicate The issue has already been reported. type/bug

Comments

@severgun
Copy link

  • Gitea version 1.4.3/1.5.0-rc installed from binary
  • Git version: 2.17.1
  • Operating system: Ubuntu Server 18.04 LTS
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Merging pull requests from web interface not working on repository with LFS.
I can commit, merge and push branches on local machine with git CLI or Github for Windows, but not in gitea web.

Web Interface just fall to error 500 page after pressing Merge button.

Gitea.log:

2018/07/17 23:07:35 [...routers/repo/pull.go:533 MergePullRequest()] [E] Merge: git clone: Cloning into '/var/lib/gitea/data/tmp/local-repo/merge-192609140.git'...
done.
Downloading File.bin (11 KB)
Error downloading object: File.bin (08afa7b): Smudge error: Error downloading File.bin (08afa7bbdbb8224c12d26dad8bb3641a8c0eacd032c47bba0f91275e0d892fef): batch request: missing protocol: "/home/git/gitea-repositories/liquid/test.git/info/lfs"

Errors logged to /var/lib/gitea/data/tmp/local-repo/merge-192609140.git/.git/lfs/objects/logs/20180717T230735.214492563.log
Use git lfs logs last to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: File.bin: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Seems like something related to lfs.url on server side, but what and how to fix?

@lunny
Copy link
Member

lunny commented Jul 20, 2018

Have you installed git-lfs on your sever?

@severgun
Copy link
Author

severgun commented Jul 20, 2018

Yes.
Also, broken once LFS pull request broke all webui merges for that repo.

@severgun
Copy link
Author

severgun commented Jul 21, 2018

After I add lfs.url = http://94.000.000.000:3000/Liquid/Test.git/info/lfs in .lfsconfig and push it to master I got new error.
From batch request: missing protocol: to Merge: git push: Invalid remote name "/home/git/gitea-repositories/liquid/Test.git"

@gerroon
Copy link

gerroon commented Aug 7, 2018

@severgun

Did you solve this issue? I am facing it as well.

@severgun
Copy link
Author

Nope. Tagged as a bug. Waiting for a fix.
Seems like gitea now in pre-alpha unstable test because there is dozens of new issues per day.

@gerroon
Copy link

gerroon commented Aug 10, 2018

@severgun thanks

@chowey
Copy link

chowey commented Sep 12, 2018

I'm getting the following error log when merging a pull request with LFS:

2018/09/12 11:24:52 [...routers/repo/pull.go:533 MergePullRequest()] [E] Merge: git push: Invalid remote name "C:\gitea\data\repos\my\repo.git"
error: failed to push some refs to 'C:\gitea\data\repos\my\repo.git'

I'm using Gitea on Windows.

@Haixing-Hu
Copy link

same problem. any solution?

@ghost
Copy link

ghost commented Nov 27, 2018

same problem.
OS:centos7

$ git lfs env
git-lfs/2.6.0 (GitHub; linux amd64; go 1.11.1; git 93702d75)
git version 2.16.5

LocalWorkingDir=
LocalGitDir=
LocalGitStorageDir=
LocalMediaDir=lfs/objects
LocalReferenceDirs=
TempDir=lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

gitea.log

2018/11/27 11:19:39 [I] LFS server enabled
2018/11/27 11:20:22 [...routers/repo/pull.go:579 MergePullRequest()] [E] Merge: git merge --no-ff --no-commit [/var/apps/gitea/data/tmp/local-repo/merge-249727395.git]: exec(11:PullRequest.Merge (git merge --no-ff --no-commit): /var/apps/gitea/data/tmp/local-repo/merge-249727395.git) failed: exit status 128(<nil>) stdout:  stderr:
hint: The remote resolves to a file:// URL, which can only work with a
hint: standalone transfer agent.  See section "Using a Custom Transfer Type
hint: without the API server" in custom-transfers.md for details.
Downloading a.zip (34 B)

hint: The remote resolves to a file:// URL, which can only work with a
hint: standalone transfer agent.  See section "Using a Custom Transfer Type
hint: without the API server" in custom-transfers.md for details.
Error downloading object: a.zip (0a12b35): Smudge error: Error downloading a.zip (0a12b35d75289e158ab0d06fe388303c7275c458d51261dc44f747be6dfedc23): batch request: missing protocol: "file:///var/apps/gitea/repositories/developer/lfs-test.git/info/lfs"

Errors logged to /var/apps/gitea/data/tmp/local-repo/merge-249727395.git/.git/lfs/logs/20181127T112022.279642685.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: a.zip: smudge filter lfs failed
 -
hint: The remote resolves to a file:// URL, which can only work with a
hint: standalone transfer agent.  See section "Using a Custom Transfer Type
hint: without the API server" in custom-transfers.md for details.
Downloading a.zip (34 B)

hint: The remote resolves to a file:// URL, which can only work with a
hint: standalone transfer agent.  See section "Using a Custom Transfer Type
hint: without the API server" in custom-transfers.md for details.
Error downloading object: a.zip (0a12b35): Smudge error: Error downloading a.zip (0a12b35d75289e158ab0d06fe388303c7275c458d51261dc44f747be6dfedc23): batch request: missing protocol: "file:///var/apps/gitea/repositories/developer/lfs-test.git/info/lfs"

Errors logged to /var/apps/gitea/data/tmp/local-repo/merge-249727395.git/.git/lfs/logs/20181127T112022.279642685.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: a.zip: smudge filter lfs failed

@stale
Copy link

stale bot commented Jan 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 26, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Feb 6, 2019
@linghu86
Copy link

same problem

1 similar comment
@Begounet
Copy link

same problem

@zeripath
Copy link
Contributor

Which version of Gitea are you using?

@Begounet
Copy link

Begounet commented May 23, 2019

Gitea Version: 1.7.1
Edit: Do you think the issue has been fixed since?
Edit2: We just saw that the Gitea version goes from 1.7.1 to 1.8.1 in 5 months! You are so efficient!
Our admin has been told about it and will update the version tonight. I will be able to tell you about it tomorrow.
Edit3: Got an emergency, we had to delay the update. We will go back to you when it will be done :)

@Begounet
Copy link

Begounet commented May 24, 2019

Ok, so we updated to 1.8.1 but the issue is still present.
Edit: the issue occured when I tried a "merge with rebase" but not with a "standard merge". Still investigating on reproducing the issue.
Edit: I made a new test by just adding one single 4x4 image (so it is filtered by Git LFS) and the merge didn't work.

@zeripath
Copy link
Contributor

OK so I bet this is same issue as #4760 and #732

@zeripath
Copy link
Contributor

zeripath commented May 25, 2019

Now I am willing to bet that you have git-lfs version greater than 2.3.4 installed on your server and gitea user has a .gitconfig file containing:

[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true

If you remove that that should act as a workaround.

OK so that's not enough. Do your repos have .lfsconfig or is there an additional lfsconfig you're running?

In particular I'm highly suspicious that the there is lfs.storage set.

@zeripath
Copy link
Contributor

zeripath commented May 25, 2019

I bet if you remove that - the problem will disappear.

@zeripath
Copy link
Contributor

zeripath commented May 25, 2019

Which is obviously not a complete solution but if it works then I know that I am at least on the right track.

@zeripath
Copy link
Contributor

OK, I think I've looked at this a bit more I think this is due to us previously cloning without setting --shared and without adding an alternative object dir reference for the pulled branch. What doesn't make sense though is that @Begounet has reported this on 1.8.1 - which also shouldn't be cloning without shared repository settings...

@Begounet I wonder can you reproduce this on master? What is your version of git lfs? Mine is:

:; git lfs version
git-lfs/2.3.4 (GitHub; linux amd64; go 1.8.3)

@ghost
Copy link

ghost commented May 26, 2019

This issue is not related to the version of git-lfs.
Gitea does not store the LFS objects in repositories/xxx.git/lfs/objects, but Git transfers the files from the local directory instead of Gitea's LFS server.

local-repo/merge-xxxxx.git/.git:

# git lfs env
Endpoint=/path/repositories/test1.git/info/lfs (auth=none)
Endpoint (head_repo)=/path/repositories/test1.git/info/lfs (auth=none)

Also, I don't think it's a good idea to download the LFS file to the local temp folder and merge the PR.

@zeripath
Copy link
Contributor

@yasuokav it might actually be related to LFS version. For example prior to 11 months ago git LFS would definitely fail on multiple alternative repositories. I don't get this problem on 2.3.4 and I know git-lfs changed their handling of local clones at some point - likely around 2.6. So if you're experiencing this bug would you please tell me what your server's version of git-lfs is? I suspect it is highly pertinent.

Now, I agree that I'm not certain that grabbing the LFS objects in order to do a merge is a good idea. I will look at stopping this. If you are experiencing this bug there are a couple of things I would like to know:

  • If you edit the $HOME/.gitconfig for the user running git (or wherever you've changed $HOME to be) and either comment out or remove the LFS filter declarations does that stop this from occurring?
  • Do any of your affected repositories have .lfsconfig files?

So that's 3 questions but the git-lfs version question is pertinent. So please tell me.

@ghost
Copy link

ghost commented May 26, 2019

@zeripath

  1. git-lfs/2.4.0
  2. It does help
  3. No

@zeripath
Copy link
Contributor

zeripath commented May 26, 2019

Cool. I can check if I can reproduce this with 2.4 - (looking at the release information for 2.4 they rewrote their file API at that point so that's highly suspicious.)

Ok.

In terms of quick fix for this I would guess that the most sensible thing is for Gitea to have its own .gitconfig in which LFS is not installed. Either that or determine a way to commit without running filters.

The correct answer is to change to an index based merging style - then filters etc don't matter as we determine what goes in to the index. You shouldn't be experiencing this bug on repo edit, or upload is because I rewrote these sections to do their work directly with the index.

@zeripath
Copy link
Contributor

But this at least finally gives those of you experiencing this bug a workaround until I get a fix in.

@zeripath
Copy link
Contributor

Sorry this has taken so long to figure out.

@zeripath
Copy link
Contributor

OK, I've finally had a chance to download git-lfs 2.4.0 and git-lfs 2.7.2 and I still can't reproduce this.

If you can work out a minimal testcase that breaks for you I can try to replicate and figure out exactly what's causing the breakage, however what I might do is add a note to the troubleshooting page.

@zeripath zeripath added issue/duplicate The issue has already been reported. and removed issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels May 27, 2019
@zeripath
Copy link
Contributor

I also think we should mark this as a duplicate of #732

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/duplicate The issue has already been reported. type/bug
Projects
None yet
Development

No branches or pull requests

9 participants