Skip to content

Failed to create repository on windows network drive #4245

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

Closed
2 of 7 tasks
BowmanChen opened this issue Jun 14, 2018 · 5 comments
Closed
2 of 7 tasks

Failed to create repository on windows network drive #4245

BowmanChen opened this issue Jun 14, 2018 · 5 comments
Labels
status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR type/bug

Comments

@BowmanChen
Copy link

BowmanChen commented 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] golang/go#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

@BowmanChen
Copy link
Author

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 ] golang/go@7a1347a

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
Copy link
Author

BowmanChen commented Jun 14, 2018

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

@lafriks lafriks added type/bug status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR labels Jun 19, 2018
@lafriks
Copy link
Member

lafriks commented Jun 19, 2018

So this looks like golang issue so waiting for version 1.11

@BowmanChen
Copy link
Author

BowmanChen commented 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
Copy link
Author

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.

@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
status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR type/bug
Projects
None yet
Development

No branches or pull requests

2 participants