tmux version: 2.4
.tmux: git version 264a577ba183bf7ce74da22a18fbb1bdba8244bf
I use prefix + , to rename window name, but then it restore to current path when i type CR in terminal.
I use prefix + , to rename pane name
I suppose what you're meaning is that you're using prefix + , to rename the current window.
This configuration sets setw -g automatic-rename on which automatically renames windows.
By default, automatic-rename-format is set to #{pane_current_cmd}. This renames windows to the name of the program being executed in the active/focused pane: bash, vim, ...
Given that, if you're seeing the current path it means you at least changed the value of automatic-rename-format and e.g. did setw -g automatic-rename-format to #{pane_current_path}.
Finally, to disable automatic window renaming, edit your ~/.tmux.conf.local copy and append:
setw -g automatic-rename off
I add this to the ~/.tmux.conf.local.
Everything is not changed.

I read the tmux manual again.
You mentioned title gets changed when hitting CR. It means the renaming happens as part of your prompt. You didn't mention which shell you were using and I suspect you're using zsh and this is your zsh prompt configuration that sends escape sequences to rename windows.
Try adding the following to your ~/.tmux.conf.local copy instead:
setw -g allow-rename off
"allow-rename" is the correct config,thanks。
I use the bash shell。
You likely have something in your Bash prompt (echo $PS1)
Did you manage to find out what in your $PS1 prompt renamed window to current directory?
my $PS1 is “[\u@\h \W]\$”。
Then something else is renaming the window title. Setting allow-rename to off doesn't fix the problem at the source.
I'm going to close this issue since it's outside my configuration's scope.
Most helpful comment
I read the
tmuxmanual again.You mentioned title gets changed when hitting
CR. It means the renaming happens as part of your prompt. You didn't mention which shell you were using and I suspect you're usingzshand this is yourzshprompt configuration that sends escape sequences to rename windows.Try adding the following to your
~/.tmux.conf.localcopy instead: