LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-08-2012, 06:42 PM   #1
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Rep: Reputation: 15
Git unable to clone from "remote" to working dir on that server?


I've been using SVN at work, but we've never been able to fully take cleanly integrate branching & merging as I'd like so with that, and the desire to allow remote developers to have a fully distributed VCS I thought I'd take a look at git.

I setup git and gitolite on a CentOS 6.3 server that we'll call nix2 and added a single repository with some content.

On my local workstation (Macbook Pro OSX 10.8) I was able to git clone git@nix2.domain.com:admin.domain.com which I understand is the same as a svn checkout. I then added a files, committed and did a git push

Code:
MacBook-Pro:admin.domain.com jukas$ git push
Counting objects: 1191, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1061/1061), done.
Writing objects: 100% (1190/1190), 1.58 MiB, done.
Total 1190 (delta 147), reused 0 (delta 0)
To git@nix2.domain.com:admin.domain.com
   a8fdd1f..6a1ec21  master -> master
All good so far, then I ssh'd to my server nix2 and tried to 'checkout' this content in my /www/htdocs/ directory only to have the remote server tell me it isn't a git repository...

Code:
[root@nix2 htdocs]# git clone git@nix2.domain.com:admin.domain.com
Initialized empty Git repository in /www/htdocs/admin.domain.com/.git/
git@nix2.domain.com's password: 
fatal: 'admin.domain.com' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
So I went back to my Macbook, deleted the folder and re-did a git clone to test and it worked fine..

Code:
MacBook-Pro:sites jukas$ git clone git@nix2.domain.com:admin.domain.com
Cloning into 'admin.domain.com'...
remote: Counting objects: 1193, done.
remote: Compressing objects: 100% (915/915), done.
remote: Total 1193 (delta 147), reused 1190 (delta 147)
Receiving objects: 100% (1193/1193), 1.58 MiB | 1.32 MiB/s, done.
Resolving deltas: 100% (147/147), done.
No matter what I tried, I was unable to do a git clone on the remote server itself. This is trivial in svn, you juts create the dir and do a svn co svn+ssh://server/var/svn-repos/repo/trunk .

I've tried doing the git clone on the server itself as the following users root, git, jukas all with the same results. When I check /var/log/secure it just shows a ssh connection opening and closing.

I thought maybe this was a RTFM situation, but in reading the process seems pretty straightforward so I'm stumped what I'm doing wrong.

Any insight is much appreciated.
 
Old 08-09-2012, 06:04 AM   #2
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
I'm not sure to understand the question completely but

maybe git uses a different syntax on OSX.

The syntaxt I'd use on Linux would be

Code:
git clone git@nix2.domain.com admin.domain.com
if "admin.domain.com" is the full name of your git repo
 
Old 08-09-2012, 12:59 PM   #3
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by heinblöd View Post
I'm not sure to understand the question completely but

maybe git uses a different syntax on OSX.

The syntaxt I'd use on Linux would be

Code:
git clone git@nix2.domain.com admin.domain.com
if "admin.domain.com" is the full name of your git repo
I tried a git clone and was told it couldn't find the repo . I ended up fixing it, which I'll explain how later, but let me briefly explain my setup more clearly.

I have a CentOS server called nix2.domain.com. On that server in /www/htdocs/admin.domain.com I have existing content I wanted to manage via git (I'm used to SVN) but also access on my macbook as well as let a handfull of other developers have access to. Because the code is commercial and devs have to sign a NDA, I can't use a public github repo and would rather host my own git remote server than pay a monthly fee. Normally I would setup SVN on nix2.domain.com add the repos and then check out the code on the desired machines.

So on nix2 I added a user called git and created /home/git/repos/admin.domain.com and did a git init --bare. I then tried to clone /www/htdocs/admin.domain.com to git@nix2.domain.com:/home/git/repos/admin.domain.com and was told it didn't appear to be a git repo.

This is the same issue I experience prior when I tried to use gitolite to create and manage repos.


Here's how I was able to workaround and fix it, but surely I should be able to add existing content to a repo, and then clone it to the 'master repo' that the remote server is hosting?

As user git I created /home/git/repos/admin.domain.com and did a git init --bare. Then on my laptop I did a git clone git@nix2.domain.com:./repos/admin.domain.com and checked out an empty repo. Next I fired up my ftp client and downloaded the content from nix2 /www/htdocs/admin.domain.com into the workingdir I just cloned. Then I did a git add . followed by a git commit and a git push origin master. Then I went to /www/htdocs/ and tarballed admin.domain.com and deleted it before doing a git clone git@nix2.domain.com:./repos/admin.domain.com .

Once I found that workaround I was able to properly clone it both in the /www/htdocs dir and in a working dir on my macbook and push / pull between the two, however this is rather cumbersome as some of the sites I need to manage via VCS are rather large with many nested subdirs which makes ftp'ing content down to my laptop a pain in the butt.

Surely there's an easier way to accomplish this? As an aside question, if I plan on managing less than 20 repos is there a compelling reason to use something like gitolite or gitosis?

Last edited by Jukas; 08-09-2012 at 01:02 PM. Reason: typos
 
Old 08-10-2012, 05:31 AM   #4
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
Well I'm not very deep into the git stuff. I have some local repos in our local net which are public as they are not reachable from the outside and I use cgit as a webinterface for that.
So maybe I can't help you much, but I remember I had once always empty repos when I tried to clone them.
Actually this was a stupid file and folder rigths thing.

The git-deamon is running as user git and when I used git init even as userX it creates an empty repo owned by user "git".

But when I added files, they were owned by "userx" and git add + git commit didn't touch them as user "git" had no rigths ...
So actually I have to do
Code:
su git
before adding files (or chown later if you prefer).

Maybe it helps ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
What's the difference between "mv dir/* /tmp" and "find dir/* -print0 | xargs" ? thomas2004ch Linux - Software 8 04-19-2012 11:43 AM
git "philosophy" understanding problems - no central server? Squall90 Programming 3 08-19-2010 10:49 AM
[SOLVED] sync "working" dir with all computers Galib Linux - Newbie 4 04-01-2010 12:42 PM
"best" way to clone a working linux system for backup, repartition harddrive, etc centguy Linux - Software 6 12-15-2008 08:15 AM
Cannot push with git. Error Message: "fatal: The remote end hung up unexpectedly" braclayrab Linux - Software 2 07-11-2008 02:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:44 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration