Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When trying to push to the GitLab repository, I get error "fatal: protocol error: bad line length character: This".
Below is some of the things I tried. Can anyone help? Thank you
Code:
[Michael@devServer first-project]$ git remote add origin git@mysite.com:root/first-project.git
[Michael@devServer first-project]$ git push -u origin master
fatal: protocol error: bad line length character: This
[Michael@devServer first-project]$ ssh git@mysite.com git-receive-pack /var/www/bidjunction/html/first-project
This account is currently not available.
[Michael@devServer first-project]$ ssh Michael@mysite.com git-receive-pack /var/www/bidjunction/html/first-project
Michael@mysite.com's password:
008af6e870c6fb0a204fa658d5e6d56306c5922b7d5e refs/heads/master report-status delete-refs side-band-64k quiet ofs-delta agent=git/1.8.3.1
0000hello
fatal: protocol error: bad line length character: hell
[Michael@devServer first-project]$ git remote add origin1 Michael@mysite.com:root/first-project.git
[Michael@devServer first-project]$ git push -u origin1 master
Michael@mysite.com's password:
fatal: 'root/first-project.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[Michael@devServer first-project]$ cat /home/Michael/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
[root@devServer log]# tail secure -f
Apr 19 01:55:56 devServer sshd[1933]: Accepted publickey for git from 12.345.67.89 port 49650 ssh2
Apr 19 01:55:56 devServer sshd[1933]: pam_unix(sshd:session): session opened for user git by (uid=0)
Apr 19 01:55:56 devServer sshd[1936]: Received disconnect from 12.345.67.89: 11: disconnected by user
Apr 19 01:55:56 devServer sshd[1933]: pam_unix(sshd:session): session closed for user git
I'm hardly a git expert (though I do use it occasionally), and I've never used GitLab. It seems like the critical problem is:
Code:
[Michael@devServer first-project]$ git push -u origin1 master
Michael@mysite.com's password:
fatal: 'root/first-project.git' does not appear to be a git repository
fatal: Could not read from remote repository.
It seems like you're trying to connect to mysite.com as user "Michael", and then trying to access a repository in root's home directory??! This seems a little bit nonsensical to me.
I guess the question is, did you ever actually create a bare repo on your server (mysite.com) that you were able to clone onto your workstation? If so, you shouldn't need to manually add a remote, it should be set up for you automatically. It doesn't look to me like you were able to do this correctly, which is why nothing else is working. What you need to do is someting like:
Code:
# server side
serveruser@mysite.com$ git init --bare /home/serveruser/myrepo.git
# workstation side
wsuser@workstation$ git clone serveruser@mysite.com:/home/serveruser/myrepo
wsuser@workstation$ cd myrepo
# add files, make changes, commit them, etc.
wsuser@workstation$ git push
What is confusing is when I create a new project using GitLab, GitLab provides the following instructions telling me I should use user git. That was when I got the first error "fatal: protocol error: bad line length character: This".
I then tried different users just for experimenting purposes. I not sure whether "root/first-project.git" is referring to the actual /root directory because it doesn't have a / in front of it.
I'm a bit confused, are you trying to push to a server owned by someone else (like GitHub) or to your own machine? If someone else runs the machine, you have to use the user and path they specified. If you're pushing to your own server, you'll need to have the repository set up and ready to accept pushes. Maybe GitLab sets up a "git" user account ... you can check this on your machine. To be honest, I always use a fully qualified path when doing a push or setting up a new remote, since I can never remember if git starts thing from / or the user's home directory :-).
Like I said, I've never used git. Unless you have some specific reason you need GitLab, it might be a good idea to start with plain vanilla git just to figure out how things work.
GitLab is just an application to create your own GitHub. As such, it is on my own machine. After setting it up, I created a repository, and after doing so, it provided instructions to push to it. When I did so, I received the errors as described in my original post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.