Failed automatic merging - filename too long

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

問題

Merging changesets containing files with long filenames/paths within Bitbucket Server fails.

The following appears in the atlassian-bitbucket.log

2016-09-13 15:38:29,640 INFO [http-nio-7990-exec-49] hansberry.nate @XLRZ5Ex938x2166x0 br38av 10.1.2.120 "GET /rest/api/latest/projects/AT/repos/bitbucket_server/pull-requests/110/merge HTTP/1.1" c.a.s.i.s.g.p.DefaultPullRequestAutoMergeStrategy AT/bitbucket_server[5]: Pull request 110@0 failed automatic merging

com.atlassian.bitbucket.scm.MergeException: The merge could not be completed automatically. Please clone 'AT/bitbucket_server', checkout 'master' and merge 'feature/awesome_feature' (or commit 'sha1sha1sha1sha1sha1sha1sha1sha1sha1sha1') manually, resolving any conflicts, and push the result.

...

Caused by: com.atlassian.bitbucket.scm.CommandFailedException: 'C:\Program Files\Git\bin\git.exe merge -m Automatic merge --no-ff --log sha1sha1sha1sha1sha1sha1sha1sha1sha1sha1' exited with code 128 saying: error: unable to create file really_imagine_that_this_file_name_is_way_too_long_for_Windows_to_handle_because_in_fact_it_should_be_much_longer.txt (Filename too long)

error: unable to create file really_imagine_that_this_file_name_is_way_too_long_for_Windows_to_handle_because_in_fact_it_should_be_much_longer.txt (Filename too long)

...

Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128

...

原因

Git has a limit of 4096 characters for a filename, but on Windows, when the git client is compiled with Git for Windows (previously compiled with msysGit), it uses an older version of the Windows API and there's a limit of 260 characters for a file path.

回避策

  1. Ensure the paths to Git\bin\git.exe and Git\cmd have been added to the path variable:
- Right-Click on My Computer.
- Click on Advanced System Settings.
- Click on Environment Variables.
- Then, under System Variables, look for the path variable and click edit.
- Add the path to git's bin and cmd at the end of the string like this: ;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd.

       2. Open PowerShell or cmd.exe and run the following:

git config --system core.longpaths true

You should then be able to decline and re-open any pull requests and/or merge as usual.

最終更新日 2016 年 9 月 16 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.