cms icon indicating copy to clipboard operation
cms copied to clipboard

Git integration does not correctly handle paths with spaces in them

Open rikh42 opened this issue 6 months ago • 1 comments

Bug description

When trying to execute the git commands (add and commit), it does not attempt to escape the path names, meaning any spaces in the path names result in git producing an error.

In this example from the logs below, there is a site with a folder called example site in its path.

Command: git add /Users/me/dev/clients/example site/example.com/content
Error: fatal: /Users/me/dev/clients/example '/Users/me/dev/clients/example is outside repository at '/Users/me/dev/clients/example site/example.com'  

How to reproduce

Create a project that has a parent folder with a space in its name. Try and use the git feature. It will claim to have completed successfully, but will have actually silently failed.

Logs


Environment

Environment
Application Name: Statamic
Laravel Version: 12.12.0
PHP Version: 8.3.20
Composer Version: 2.8.8
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 1
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.54.0 PRO

Statamic Addons
statamic/ssg: 3.1.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

rikh42 avatar May 03 '25 12:05 rikh42

Can you provide the full stack trace for the error you're seeing?

I believe spaces in directory names is generally considered bad practice.

duncanmcclean avatar May 06 '25 08:05 duncanmcclean

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

github-actions[bot] avatar Jul 06 '25 02:07 github-actions[bot]

I love you even though you don't have feelings, stale bot.

jesseleite avatar Jul 07 '25 16:07 jesseleite