Failed to create repository on windows network drive #1933

Closed
opened 2025-11-02 04:18:09 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @BowmanChen on GitHub (Jun 14, 2018).

  • Gitea version (or commit ref): 2.14.2
  • Git version: 2.16.2
  • Operating system: Windows 2012 Server R2
  • 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

I found Gitea have problems to create repository on windows network drive. thus, I tried to using mklink command to creating symbolic links on networked drive that still no useful. Does anyone know how to configure gitea to access windows network drive?
My issue very close this problems : [os: IsDir doesn't work with Windows OneDrive #22579] https://github.com/golang/go/issues/22579

My specific ROOT in app.ini as below. [repository] ROOT = W:/gitrepos1 <--- W: is network drive mapped.

D:>mklink /D “d:\gitrepos1” “W:\gitrepos1”
symbolic link created for d:\gitrepos1 <<===>> W:\gitrepos1
D:>net use
New connections will be remembered.
Status Local Remote Network
W: \xyz\gitprod1 xyz Network
The command completed successfully.

#gitea.log
2018/06/13 08:36:53 [I] Log Mode: File(Info)
2018/06/13 08:36:53 [I] XORM Log Mode: File(Info)
2018/06/13 08:36:53 [I] Cache Service Enabled
2018/06/13 08:36:53 [I] Session Service Enabled
2018/06/13 08:36:53 [I] Git Version: 2.16.2
2018/06/13 08:36:54 [I] SQLite3 Supported
2018/06/13 08:36:54 [I] Run Mode: Production
2018/06/13 08:36:55 [I] Listen: http://0.0.0.0:80
2018/06/13 08:36:55 [I] LFS server enabled
2018/06/13 08:38:08 […routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir D:\gitrepos1\itadmin\test1.git: The system cannot find the path specified.
2018/06/13 08:38:59 […routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir D:\gitrepos1\itadmin\test1.git: The system cannot find the path specified.

Screenshots

Originally created by @BowmanChen on GitHub (Jun 14, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 2.14.2 - Git version: 2.16.2 - Operating system: Windows 2012 Server R2 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant - Log gist: ## Description I found Gitea have problems to create repository on windows network drive. thus, I tried to using mklink command to creating symbolic links on networked drive that still no useful. Does anyone know how to configure gitea to access windows network drive? My issue very close this problems : [os: IsDir doesn't work with Windows OneDrive #22579] https://github.com/golang/go/issues/22579 My specific ROOT in app.ini as below. [repository] ROOT = W:/gitrepos1 <--- W: is network drive mapped. D:>mklink /D “d:\gitrepos1” “W:\gitrepos1” symbolic link created for d:\gitrepos1 <<===>> W:\gitrepos1 D:>net use New connections will be remembered. Status Local Remote Network W: \\xyz\gitprod1 xyz Network The command completed successfully. #gitea.log 2018/06/13 08:36:53 [I] Log Mode: File(Info) 2018/06/13 08:36:53 [I] XORM Log Mode: File(Info) 2018/06/13 08:36:53 [I] Cache Service Enabled 2018/06/13 08:36:53 [I] Session Service Enabled 2018/06/13 08:36:53 [I] Git Version: 2.16.2 2018/06/13 08:36:54 [I] SQLite3 Supported 2018/06/13 08:36:54 [I] Run Mode: Production 2018/06/13 08:36:55 [I] Listen: http://0.0.0.0:80 2018/06/13 08:36:55 [I] LFS server enabled 2018/06/13 08:38:08 […routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir D:\gitrepos1\itadmin\test1.git: The system cannot find the path specified. 2018/06/13 08:38:59 […routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir D:\gitrepos1\itadmin\test1.git: The system cannot find the path specified. ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the status/blockedtype/bug labels 2025-11-02 04:18:09 -06:00
Author
Owner

@BowmanChen commented on GitHub (Jun 14, 2018):

gitea cannot support UNC path. I tried reference this url hope to solve my problems, but still failed.
[os: make MkdirAll support path in extended-length form ] https://github.com/golang/go/commit/7a1347a1a1f6e99627a8e9bf098351c13162e5d6

In app.ini , I set to different UNC path , both not works on gitea.
case1:
[repository]
//?/W:/gitrepos1
case2:
[repository]
ROOT = //?/W:/

2018/06/15 00:09:06 [I] Log Mode: File(Info)
2018/06/15 00:09:06 [I] XORM Log Mode: File(Info)
2018/06/15 00:09:06 [I] Cache Service Enabled
2018/06/15 00:09:06 [I] Session Service Enabled
2018/06/15 00:09:06 [I] Git Version: 2.16.2
2018/06/15 00:09:06 [I] SQLite3 Supported
2018/06/15 00:09:06 [I] Run Mode: Production
2018/06/15 00:09:07 [I] Listen: http://0.0.0.0:80
2018/06/15 00:09:07 [I] LFS server enabled
2018/06/15 00:09:47 [...routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir \?\W:\gitrepos1\itadmin\test1.git: The system cannot find the path specified.
2018/06/15 00:14:33 [I] Log Mode: File(Info)
2018/06/15 00:14:33 [I] XORM Log Mode: File(Info)
2018/06/15 00:14:33 [I] Cache Service Enabled
2018/06/15 00:14:33 [I] Session Service Enabled
2018/06/15 00:14:33 [I] Git Version: 2.16.2
2018/06/15 00:14:34 [I] SQLite3 Supported
2018/06/15 00:14:34 [I] Run Mode: Production
2018/06/15 00:14:34 [I] Listen: http://0.0.0.0:80
2018/06/15 00:14:34 [I] LFS server enabled
2018/06/15 00:15:23 [...routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir \?\W:\itadmin\test1.git: The system cannot find the path specified.

I compare tested windows command prompt that work.
D:>dir \?\W:
Volume in drive \?\W: is gitprod1
Volume Serial Number is 0001-172A

Directory of \?\W:

06/11/2018 09:04 PM

gitrepos1
0 File(s) 0 bytes
1 Dir(s) 4,398,046,511,104 bytes free

@BowmanChen commented on GitHub (Jun 14, 2018): gitea cannot support UNC path. I tried reference this url hope to solve my problems, but still failed. [os: make MkdirAll support path in extended-length form ] https://github.com/golang/go/commit/7a1347a1a1f6e99627a8e9bf098351c13162e5d6 In app.ini , I set to different UNC path , both not works on gitea. case1: [repository] //?/W:/gitrepos1 case2: [repository] ROOT = //?/W:/ 2018/06/15 00:09:06 [I] Log Mode: File(Info) 2018/06/15 00:09:06 [I] XORM Log Mode: File(Info) 2018/06/15 00:09:06 [I] Cache Service Enabled 2018/06/15 00:09:06 [I] Session Service Enabled 2018/06/15 00:09:06 [I] Git Version: 2.16.2 2018/06/15 00:09:06 [I] SQLite3 Supported 2018/06/15 00:09:06 [I] Run Mode: Production 2018/06/15 00:09:07 [I] Listen: http://0.0.0.0:80 2018/06/15 00:09:07 [I] LFS server enabled 2018/06/15 00:09:47 [...routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir \\?\W:\gitrepos1\itadmin\test1.git: The system cannot find the path specified. 2018/06/15 00:14:33 [I] Log Mode: File(Info) 2018/06/15 00:14:33 [I] XORM Log Mode: File(Info) 2018/06/15 00:14:33 [I] Cache Service Enabled 2018/06/15 00:14:33 [I] Session Service Enabled 2018/06/15 00:14:33 [I] Git Version: 2.16.2 2018/06/15 00:14:34 [I] SQLite3 Supported 2018/06/15 00:14:34 [I] Run Mode: Production 2018/06/15 00:14:34 [I] Listen: http://0.0.0.0:80 2018/06/15 00:14:34 [I] LFS server enabled 2018/06/15 00:15:23 [...routers/repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository: chdir \\?\W:\itadmin\test1.git: The system cannot find the path specified. I compare tested windows command prompt that work. D:\>dir \\?\W:\ Volume in drive \\?\W: is gitprod1 Volume Serial Number is 0001-172A Directory of \\?\W: 06/11/2018 09:04 PM <DIR> gitrepos1 0 File(s) 0 bytes 1 Dir(s) 4,398,046,511,104 bytes free
Author
Owner

@BowmanChen commented on GitHub (Jun 14, 2018):

add more reference ,
[os: MkdirAll fails when creating top-level UNC paths on Windows #10900] https://github.com/golang/go/issues/10900
[os: IsDir doesn't work with Windows OneDrive #22579] https://github.com/golang/go/issues/22579

@BowmanChen commented on GitHub (Jun 14, 2018): add more reference , [os: MkdirAll fails when creating top-level UNC paths on Windows #10900] https://github.com/golang/go/issues/10900 [os: IsDir doesn't work with Windows OneDrive #22579] https://github.com/golang/go/issues/22579
Author
Owner

@lafriks commented on GitHub (Jun 19, 2018):

So this looks like golang issue so waiting for version 1.11

@lafriks commented on GitHub (Jun 19, 2018): So this looks like golang issue so waiting for version 1.11
Author
Owner

@BowmanChen commented on GitHub (Jun 20, 2018):

Hi @lafriks
It indeed related to golang issue. As my build a golang developer branches(newer than golang official 1.10.3) by myself. and tested my go sample code as below.

func main() {
	src := "w:/a/b/c"
	err2 := os.MkdirAll(src, os.ModePerm)
	if err2 != nil {
		fmt.Println(err2)
	} else {
		fmt.Println("create ok: " + src)
	}
}

I'm able to created folder on windows network drive. and then I'm tried to download gitea source code and rebuild it with my build golang developer version. After running new build gitea on my windows server that still failed and got same error message: The system cannot find the path specified.
I'm so sad , I'm still under debugging why gitea still report failed to created repository [repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository:]

https://github.com/go-gitea/git/blob/master/repo.go Line No. 61
...
// InitRepository initializes a new Git repository.
func InitRepository(repoPath string, bare bool) error {
os.MkdirAll(repoPath, os.ModePerm)
...

@BowmanChen commented on GitHub (Jun 20, 2018): Hi @lafriks It indeed related to golang issue. As my build a golang developer branches(newer than golang official 1.10.3) by myself. and tested my go sample code as below. ``` func main() { src := "w:/a/b/c" err2 := os.MkdirAll(src, os.ModePerm) if err2 != nil { fmt.Println(err2) } else { fmt.Println("create ok: " + src) } } ``` I'm able to created folder on windows network drive. and then I'm tried to download gitea source code and rebuild it with my build golang developer version. After running new build gitea on my windows server that still failed and got same error message: The system cannot find the path specified. I'm so sad , I'm still under debugging why gitea still report failed to created repository [repo/repo.go:146 handleCreateError()] [E] CreatePost: initRepository: InitRepository:] https://github.com/go-gitea/git/blob/master/repo.go Line No. 61 ... // InitRepository initializes a new Git repository. func InitRepository(repoPath string, bare bool) error { os.MkdirAll(repoPath, os.ModePerm) ...
Author
Owner

@BowmanChen commented on GitHub (Jun 20, 2018):

Hi @lafriks
I must analogize. Now, I knew why cannot create repository on windows network drive due to I register Gitea as a Windows service which Gitea CANNOT create repository on windows network drive, but CAN create repository on local disk without problems.

I stop Gitea Windows service and open a command prompt (cmd) as an Administrator, then run the following command: gitea.exe web, then Gitea able to create repository on windows network drive successfully.
gitea.exe use official version 1.4.2

I close this issue.
Many thanks.

@BowmanChen commented on GitHub (Jun 20, 2018): Hi @lafriks I must analogize. Now, I knew why cannot create repository on windows network drive due to I register Gitea as a Windows service which Gitea CANNOT create repository on windows network drive, but CAN create repository on local disk without problems. I stop Gitea Windows service and open a command prompt (cmd) as an Administrator, then run the following command: gitea.exe web, then Gitea able to create repository on windows network drive successfully. gitea.exe use official version 1.4.2 I close this issue. Many thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1933