Invalid characters in ref or filename when pushing

1,711 views
Skip to first unread message

Christopher Hunt

unread,
Nov 7, 2011, 2:42:17 PM11/7/11
to gitolite
Thanks for providing gitolite.

I have now installed it and all appears to be well except that I
cannot push to it given a repo I've migrated from svn. Specifically
when I try to push I receive the messages:

remote: invalid characters in ref or filename: refs/tags/Airport%20GML
%20Model-1.0.0
remote: error: hook declined to update refs/tags/Airport%20GML
%20Model-1.0.0

Can you please advise on how I may circumvent this issue. Thanks for
any help.

Kind regards,
Christopher

Sitaram Chamarty

unread,
Nov 7, 2011, 7:23:32 PM11/7/11
to Christopher Hunt, gitolite
On Tue, Nov 8, 2011 at 1:12 AM, Christopher Hunt <hun...@gmail.com> wrote:
> Thanks for providing gitolite.
>
> I have now installed it and all appears to be well except that I
> cannot push to it given a repo I've migrated from svn. Specifically
> when I try to push I receive the messages:
>
> remote: invalid characters in ref or filename: refs/tags/Airport%20GML
> %20Model-1.0.0
> remote: error: hook declined to update refs/tags/Airport%20GML
> %20Model-1.0.0

(1) change the tag name not to use "%"

or (2) see the last section ("constants that aren't") in
http://sitaramc.github.com/gitolite/rc.html for how to change the
patterns to allow additional characters. The one you want for this
specific case is GL_REF_OR_FILENAME_PATT

If you choose option 2, you'd better know what you're doing, although
% seems to be harmless enough I guess.

Christopher Hunt

unread,
Nov 7, 2011, 8:22:23 PM11/7/11
to gitolite
Thanks for the reply. I might try the second approach given that I've
got many hundreds of tags with the URL encoding and thus % character
appearing. Thanks again.

Sitaram Chamarty

unread,
Dec 12, 2012, 3:50:09 AM12/12/12
to Vassil Keremidchiev, gito...@googlegroups.com, hun...@gmail.com
On Wed, Dec 12, 2012 at 2:07 PM, Vassil Keremidchiev <var...@gmail.com> wrote:
> Hello!
>
> We have problems with brackets in file names during pushing. With message
> like this:
> remote: FATAL: invalid characters in ref or filename:
> 'VREF/NAME/research/project/structs (1).cpp'
>
> Brackets are not incorrect characters for GIT or OS.
> Are there updates for Gitolite to fix this issue?

No, but it's not needed. Here's how you can solve it yourself.

Look at line 49 of src/lib/Gitolite/Rc.pm, where the variable
$REF_OR_FILENAME_PATT is defined. Replicate it at the end [1] of your
rc file (~/.gitolite.rc) then change it how you like. In your case
I'd add '()' just after the second '[' in the expression.

That's it.

[1]: i.e., *outside* the definition of the %RC hash

Vassil Keremidchiev

unread,
Jan 10, 2013, 12:49:55 PM1/10/13
to gito...@googlegroups.com, hun...@gmail.com
This does not solve our problem. In the settings we have something like:
repo testing
RW = admin

RW VREF/NAME/ = admin
- VREF/NAME/ = admin

and only on VREF/NAME/ it is doing that problem. Normally it is working for all other files. And if last two lines are not used then it is working Okay.

Sitaram Chamarty

unread,
Jan 11, 2013, 11:20:29 AM1/11/13
to Vassil Keremidchiev, gitolite
try the attached patch and let me know if it works for you...
> --
>
>



--
Sitaram
0001-access-the-pattern-for-refs-is-too-strict-for-filena.patch

Vassil Keremidchiev

unread,
Jan 14, 2013, 2:02:06 PM1/14/13
to gito...@googlegroups.com, hun...@gmail.com
07 ноември 2011, понеделник, 21:42:17 UTC+2, Christopher Hunt написа:
Great! With this patch it is working like a charm!
Thank You very much! Gitolite is great software!
Reply all
Reply to author
Forward
0 new messages