LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-19-2014, 10:14 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Rep: Reputation: Disabled
Can't push to Git Repository


I have GitLab installed on a Centos box per https://github.com/gitlabhq/gitlab-r...install/centos.

I have a local Git repository on the same box.

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
 
Old 04-20-2014, 11:00 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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
 
Old 04-20-2014, 11:52 AM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Thanks btmiller,

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.

Should I not be using git as the username?


Quote:
Git global setup:

Code:
git config --global user.name "Michael Reed"
git config --global user.email "michael@gmail.com"
Create Repository

Code:
mkdir testproject
cd testproject
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@mysite.com:root/testproject.git
git push -u origin master
Existing Git Repo?

Code:
cd existing_git_repo
git remote add origin git@mysite.com:root/testproject.git
git push -u origin master
 
Old 04-20-2014, 08:01 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 04-20-2014, 10:48 PM   #5
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Hi btmiller,

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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Git: Selective Push yooden Programming 3 03-20-2014 03:27 PM
git: shorter way to deal with commits you don't want to push? stateless Programming 6 10-31-2013 05:23 PM
Cannot pull or push to Git repository as normal user abrinister Linux - Networking 12 10-26-2012 02:47 AM
[SOLVED] git push in a git-init without --bare option? xeon123 Linux - Newbie 1 06-27-2011 03:44 AM
git push origin doesn't update the remote repository immediately mohtasham1983 Linux - Server 1 07-15-2009 01:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration