Getcwd: cannot access parent directories

Hello, I’ve a problem with my current Gitea deployment where the occasional push to the server will return the following server error message:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

Failing the push to the gitea server. access is mainly via ssh repository urls.

Server Information:
Unraid server with gitea docker
unraid: 6.9.2
docker: Container ID: 697c3f687632 By: gitea/gitea
gitea: 1.16.8
git: 2.30.3

Repository Root Path /data/git/repositories
Static File Root Path /data/gitea
Custom File Root Path /data/gitea
Log Path /data/gitea/log
LFS Content Path /data/git/lfs
GITEA_CUSTOM /data/gitea
GITEA_WORK_DIR /data/gitea

/data is mapped to a folder on the docker host.

This looks like a client side problem, right? Could you please share details about how you push to the gitea server exactly?

Using Fork (but also had the problem with SourceTree) Both using the external git installed on the system.

Git version: 2.36.1.windows.1

I get this on multiple systems and even get this when directly interacting with the git over console.

The error returns as a Server error response on the push call.

It’s like 10% of the push attempts that seem to fail.

It would be super useful if you could share the exact command you type and all the output. There may be a clue as to why that happens. A 10% failure rate may suggest the problem is unrelated to Gitea (just a hunch).

Yes I thought about that just after I closed the console only had that one line copied. And of course it hasn’t happen during the rest of this day. I will post all the console output as soon as it happens again probably tomorrow.

Anonymized the repository url
Out put after a Git push command:

[03:07:53]	[Step 1/1] Locking support detected on remote "origin". Consider enabling it with:
[03:07:53]	[Step 1/1]   $ git config lfs.https://gitea.***.net/****/Library2022.git/info/lfs.locksverify true
[03:07:55]	[Step 1/1] Uploading LFS objects: 100% (2/2), 52 KB | 0 B/s, done.
[03:07:56]	[Step 1/1] remote: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory        
[03:07:56]	[Step 1/1] remote: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory        
[03:07:56]	[Step 1/1] remote: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory        
[03:07:56]	[Step 1/1] fatal: unable to get current working directory: No such file or directory
[03:07:56]	[Step 1/1] Gitea: Internal error
[03:07:56]	[Step 1/1] send-pack: unexpected disconnect while reading sideband packet
[03:07:56]	[Step 1/1] fatal: the remote end hung up unexpectedly
[03:07:56]	[Step 1/1] Process exited with code 128

That output is not familiar to me. Can you please share the exact command line you typed? Is it

$ git push

or something else?

That specific one I posted was via an automatic build. It uses the following lines to commit the changes

git add -A
git commit -m "Updated %CommitBranch% %DLLName%" -q
git push origin %CommitBranch%

Since it happens rarely, could it be a something related to the automatic build? I can imagine the environment of the automatic build changing from one run to the other. I can’t quite figure out why a git push to Gitea would fail to perform 10% of the time when repeated in the exact same environment.

It’s a real mystery that’s why I posted it here. Sadly the problem doesn’t only occur in the automatic build system. Even pushing from the developer PC sometimes fails. It’s less of a problem there because a quick new push will fix it. On the build system it’s more annoying because it fails the build.

Gitea: Internal error

Seems to suggest it’s something on the server side. That’s why I’m expecting a configuration error. Maybe some timed period task Gitea executes that leaves the current working directory on some directory that is removed?

Do you have access to the Gitea logs? There will be a clue there if there is a problem server side at the time of the failure.

I will try to catch it in the act. But scanning the gitea.log file I’m not finding much. The only reoccurring error is.

2022/06/21 09:56:44 ...s/context/context.go:314:PlainTextBytes() [E] PlainTextBytes: Not found.

But nothing about getcwd.

[git@centos7 t2]$ git push -u origin master
error: 源引用规格 master 没有匹配
error: 推送一些引用到 '192.168.56.104:gitea/test2.git' 失败
[git@centos7 t2]$ git push -u origin main
Gitea: Internal error
fatal: 无法读取远程仓库。

Thanks, I will keep an eye on it. Doesn’t seem to be completely equal but might be relevant.

In the mean time it’s been a day without any errors. Also a day where I had to database edit gitea to get access to certain repo’s again because of a bug in 1.17-rc1. Fun note the docker container upgraded it self to 1.17-rc1 instead staying on the actual release version 1.16.8 :frowning:

But maybe the other bug has been fixed in 1.17 :crossed_fingers:

It is better to not use the “latest” tag but always use the precise version. There sometime are mistake in how Gitea releases are published. See the Hostea upgrade Guide for details. A warning was sent on the Hostea mastodon account on June 21st.

1.17 (none rc) didn’t fix the problem but does provide some additional information in the Gitea log.

2022/09/20 10:57:47 ...ers/web/repo/pull.go:1053:MergePullRequest() [E] Merge: git push: fatal: unable to get current working directory: No such file or directory
	send-pack: unexpected disconnect while reading sideband packet
	fatal: the remote end hung up unexpectedly
	
2022/09/20 10:57:52 ...ers/web/repo/pull.go:1053:MergePullRequest() [E] Merge: git push: fatal: unable to get current working directory: No such file or directory
	send-pack: unexpected disconnect while reading sideband packet
	fatal: the remote end hung up unexpectedly
	
2022/09/20 11:06:02 ...rvices/lfs/server.go:506:authenticate() [W] [6329827a-8] Authentication failure for provided token with Error: no token
2022/09/20 11:07:58 ...rvices/lfs/server.go:506:authenticate() [W] [632982ee] Authentication failure for provided token with Error: no token
2022/09/20 11:16:13 ...rvices/lfs/server.go:506:authenticate() [W] [632984dd] Authentication failure for provided token with Error: no token
2022/09/20 12:41:06 ...ers/web/repo/pull.go:1053:MergePullRequest() [E] Merge: git push: fatal: unable to get current working directory: No such file or directory
	send-pack: unexpected disconnect while reading sideband packet
	fatal: the remote end hung up unexpectedly
	
2022/09/20 13:34:10 ...rvices/lfs/server.go:506:authenticate() [W] [6329a532] Authentication failure for provided token with Error: no token
2022/09/20 13:34:10 ...rvices/lfs/server.go:506:authenticate() [W] [6329a532-2] Authentication failure for provided token with Error: no token
2022/09/20 16:26:06 ...s/repository/push.go:262:pushUpdates() [E] [6329cd7d-5] repo_module.CacheRef %!s(int64=88)/develop failed: exit status 128 - fatal: Unable to read current working directory: No such file or directory
	 - fatal: Unable to read current working directory: No such file or directory

Still unsure if this is a bug in Gitea or a configuration error.