Git push results in fatal: protocol error: bad line length character: This

后端 未结 21 836
春和景丽
春和景丽 2020-11-28 10:56

I am trying to get GitLab working on my server (running CentOS 6.5). I followed the gitlab-receipe to the line, but I just can\'t get it working. I am able to access the web

相关标签:
21条回答
  • 2020-11-28 11:43

    Just adding a possible solution to others in my situation. In my case I was trying to push a tag.

    git push heroku MYTAG:master
    

    It wasn't until I dereferenced the tag that it worked

    git push heroku MYTAG^{}:master
    

    You can read more about it here: What does ^{} mean in git?

    <rev>^{}, e.g. v0.99.8^{}

    A suffix ^ followed by an empty brace pair means the object could be a tag, and dereference the tag recursively until a non-tag object is found.

    0 讨论(0)
  • 2020-11-28 11:44

    In my case that error was fixed by changing remote git-user shell to git-shell using chsh:

    chsh -s $(command -v git-shell) git
    

    Official git-shell documentation. For security reasons it is highly recommended to use this shell for git-user on remote repository server.

    0 讨论(0)
  • 2020-11-28 11:47

    If anyone else has this problem, the solution is to change the login shell of the user 'git' (or whatever your user is called) to /bin/bash. This can be done via the command : usermod -s /bin/bash git (Link). The reason for changing the login shell is because the default shell for the git user is /sbin/nologin (or similar, depending on environment), which prevents the git application from logging in as the git user on the git server.

    0 讨论(0)
  • 2020-11-28 11:47

    I experienced this error message today ("No s"), and it actually had to do with me having no rights to push to the targeted repository. Even though the error message is very weird, this might help people continue to work.

    We use Gitlab.

    0 讨论(0)
  • 2020-11-28 11:47

    In my case (private key over ~/.ssh/config) I had to leave out the ssh part in:

    git clone ssh://git@hostname:username/repository.git
    

    It worked with:

    git clone git@hostname:username/repository.git
    

    Error message was:

    fatal: protocol error: bad line length character: No s

    0 讨论(0)
  • 2020-11-28 11:49

    Just for other users reference:

    fatal: protocol error: bad line length character: no s
    can be a truncated answer for "No such project".
    

    As in my case, this kind of error can be fixed by adding user (even yourself) to the project in gitlab:

    https://gitlab.com/username/your_project/project_members

    also, ensure your public key is set in your user Profile settings > SSH Key or in Project > Settings > Deploy Keys

    https://gitlab.com/profile/keys

    0 讨论(0)
提交回复
热议问题