Newbie Q: Can't do first push to web server

Asked by James Dean

Hello,
I have a newbie question about Bazaar, please:

Briefly:
- I'm having trouble getting my first "bzr push" to a web server to work.

- I'm experienced with CVS and SVN, but this is my first time trying to use a DVCS.

- I hope this email is to the right address, and that I'm not violating some protocol as a newbie. I read quite a bit of doc, tried to search the archives, and so on.

System:
======
- OS/X 10.5
- Just installed Bzr 2.1.0 (I think that's stable, right?)

What I'm Trying to Do Generally
=========================
Generally
------------
- I have a Mac Desktop, and a Mac Laptop.
- I want to use the Standalone configuration (I think)
- I want to be able to keep the 2 machines in sync 2 ways:
   - Via web server (this email)
   - Via shared drive (separate email, later)
- Therefore, I want to have 4 Standalone Branches.
     - Desktop
     - Laptop
     - Webserver (trying to create this now)
     - Shared drive (later...)
 (is this reasonable?)

- I also want to eventually publish the project on this or another web server.

- I have used bzr init to create a local branch. (I'm not sure if that's a repository too - I don't think so).
- I committed 3 files, and bzr status seems ok - those 3 files are not unknown.

What I'm trying to do, Specifically
==========================
I am trying to push my first test bzr code tree to my web server.

Webserver Setup
---------------------
- I have a login account, with a home directory, eg /home/my_username
- There is a public_html link to another filesystem
- Under public_html are directories for 3 domains I manage. I'm interested in "my_domain_dir".
- Under my_domain, I want to put my project directory: my_project:
   /www/home/my_username/public_html/my_domain_dir/my_project
   - And this is where I want/expect my .bzr directory to go.

Domains
-----------
- There are 2 urls, and I don't know which one you want:
   - my_domain.net
   - their_server_where_I_login.com
   - I tried both (see below)

Directory
------------
- It seems I can create the target project directory, or not, and --use-existing-dir depending...
   - Tried both with and without (see below)

The documentation says:
   "You don’t need a special server to publish a bzr branch, just a normal web server.
   Just mirror the files to your server, including the .bzr directory.
   One can push a branch (or the changes for a branch) by one of the following three methods:

   The best method is to use bzr itself to do it.

   % bzr push sftp://servername.com/path/to/directory
   (The destination directory must already exist unless the --create-prefix option is used.)

Question: What is "path/to/directory" supposed to be, based on my server directory structure mentioned above?
    public_html/my_domain_dir/my_project_dir
    public_html/my_domain_dir
    my_project_dir/my_project_dir
    my_project_dir

   - I tried a variety of these, but could not get anything to work (some examples below).

My Attempts
==========
I usually use ftp to transfer files to that system, so I tried that and also sftp.
(substituting "my_username" for my actual username, "my_domain.net" for my domain, etc)

- These attempts are all from within my local project directory - the directory containing the .bzr directory.

FTP
-----
[/usr/www/users/my_username/my_domain_dir/my_proj exists]

bzr push ftp://my_username@my_domain.net/
FTP my_username@my_domain.net password:
bzr: ERROR: Target directory ftp://my_username@my_domain.net/ already exists, but does not have a .bzr directory. Supply --use-existing-dir to push there anyway.

bzr push ftp://my_username@my_domain.net/ --use-existing-dir
FTP my_username@my_domain.net password:
bzr: ERROR: Target directory ftp://my_username@my_domain.net/ already contains a .bzr directory, but it is not valid.

  - There is no .bzr directory anywhere on the webserver - I swear.
      - Checked:

%pwd
/usr/home/my_username
%ls -al
total 300
drwxr-xr-x 9 my_username users 512 Mar 11 22:49 .
drwx--x--x 171 root wheel 3584 Feb 20 18:13 ..
-rw-r--r-- 1 my_username users 628 Sep 8 2002 .cshrc
[...]

%cd public_html/
%ls -al
total 24
drwxr-xr-x 8 my_username users 512 May 18 2007 .
drwx--x--x 171 root wheel 3584 Feb 20 18:13 ..
drwx---r-x 10 my_username users 512 Jul 20 2008 abc
[...]

%cd jcd
%ls -al
total 28
drwx---r-x 5 my_username users 512 Mar 11 20:06 .
drwxr-xr-x 8 my_username users 512 May 18 2007 ..
drwxr-xr-x 3 my_username users 512 May 18 2007 DProject
[...]

%cd my_proj/
%ls -al
total 4
drwxr-xr-x 2 my_username users 512 Mar 11 20:06 .
drwx---r-x 5 my_username users 512 Mar 11 20:06 ..
%

- remove my_project subdirectory from the server,
  => get the exact same 2 error messages.

- Add my_project to push command:
bzr push ftp://my_username@my_domain.net/my_proj
FTP my_username@my_domain.net password:
bzr: ERROR: Target directory ftp://my_username@my_domain.net/my_proj already exists, but does not have a .bzr directory. Supply --use-existing-dir to push there anyway.

- Add --use-existing-dir as suggested:
bzr push ftp://my_username@my_domain.net/my_proj --use-existing-dir
FTP my_username@my_domain.net password:
bzr: ERROR: Parent directory of ftp://my_username@my_domain.net/my_proj does not exist.
You may supply --create-prefix to create all leading parent directories.

- Add --create-prefix as suggested:
bzr push ftp://my_username@my_domain.net/my_proj --use-existing-dir --create-prefix
FTP my_username@my_domain.net password:
bzr: ERROR: No such file: '/my_proj': error w/ stat: 550 No such directory.

- I thought you were going to create it for me!?
- OK, create that directory on the server and try again.
bzr push ftp://my_username@my_domain.net/my_proj --use-existing-dir --create-prefix
FTP my_username@my_domain.net password:
bzr: ERROR: No such file: '/my_proj': error w/ stat: 550 No such directory.

Another Angle
=========
OK, maybe I'm supposed to use my ISP's server name, not my domain name. Try that:

> bzr push ftp://my_username@isp_hostname
FTP my_username@isp_hostname password:
bzr: ERROR: Target directory ftp://my_username@isp_hostname already exists, but does not have a .bzr directory. Supply --use-existing-dir to push there anyway.

> bzr push ftp://my_username@isp_hostname --use-existing-dir
FTP my_username@isp_hostname password:
bzr: ERROR: Target directory ftp://my_username@isp_hostname already contains a .bzr directory, but it is not valid.

> bzr push ftp://my_username@isp_hostname/my_proj --use-existing-dir
FTP my_username@isp_hostname password:
bzr: ERROR: Parent directory of ftp://my_username@isp_hostname/my_proj does not exist.
You may supply --create-prefix to create all leading parent directories.

> bzr push ftp://my_username@isp_hostname/my_proj --use-existing-dir --create-prefix
FTP my_username@isp_hostname password:
bzr: ERROR: No such file: '/my_proj': error w/ stat: 550 No such directory.

[Tried some other variations of the URL - really unclear what that's supposed to be]

Questions
========
- Am I supposed to install Bazaar on the web server? I'm not sure if I can do that.

- What path is that supposed to be in the 'bzr push' command?
    - Starting at my ftp login home directory?
    - Starting under public_html?
    - Something else?

- Is there something wrong with my whole approach?
   - I tried using 'branch' instead of 'push', but that didn't seem to work, and didn't seem right.
   - Should I be trying to run something on the server first?

- Is there another tutorial somewhere, which gives an example of how to do this?

- Other ideas?

Thanks very much in advance,
- Jim

Question information

Language:
English Edit question
Status:
Answered
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Martin Pool (mbp) said :
#1

Hi Jim,

Sorry for the delay, your question looked intimidatingly big when I first saw it :-) but it's actually pretty clear.

You don't need to install bzr on the server if you're using ftp or sftp.

The path in the url starts at the machine's root directory. To get to say public_html in your home directory you need sftp://example.com/~/public_html

Your use of push is correct

You might want to look at https://launchpad.net/bzr-upload if you want people to be able to see the contents of the branch in a web server.

http://brianna.laugher.id.au/blog/20/using-bzr-for-developing-a-web-app might help

hth, feel free to ask again

Revision history for this message
James Dean (james-jcdean) said :
#2

Hi Martin,
Ha! I got a push to work! Thanks for your help.

- Key points:
 - Used "~" as the name of my login directory in the path in the push
command.
  - or ~$USER - see below
 - ...or full path from server root.

- Possible key points:
 - Use the server name that I use to ssh into, not my own domain name.
 - Use sftp.
  - I never got an ftp example to work.
  - I had started with sftp, but moved to ftp after first n failures.

Duncan McGreggor has been helping me offline, and his examples
correctly showed both ways you mentioned:
 - Full path from root
 - Use of ~ to indicate home directory, as in ~$USER
However, I did not pick up on that key point somehow :-(

Finally tried to push to a shared drive since I could not get the push
to the web server to work. Here, we ran into this bug:

=============== From Duncan's email ================
Here's a bug that may address your issue:
  https://bugs.edge.launchpad.net/bzr/+bug/98836

Are you using SMB, AFP, or NFS?

For SMB, there's this ticket (marked as a duplicate of the one above,
but it has some more info):
  https://bugs.edge.launchpad.net/bzr/+bug/31006

============= End From Duncan's Email ==============

I was not smart enough to figure out how to use the information in
those reports to, I guess, enable file locking on my Mac Time Capsule
shared drive. So I confess I installed an Hg repository on the shared
drive. However, now I have bzr shared through the web, and hg shared
through the local drive. Maybe I'll use them for different projects
and see which one is more fun to use ;-)

As happens too often, I banged my head against the wall for a long
time, but it turned out to be the wrong wall - sorry!

Thanks again for your help, both of you,
- Jim

On Mar 19, 2010, at 3:08 AM, Martin Pool wrote:

> Your question #104081 on Bazaar changed:
> https://answers.edge.launchpad.net/bzr/+question/104081
>
> Status: Open => Answered
>
> Martin Pool proposed the following answer:
> Hi Jim,
>
> Sorry for the delay, your question looked intimidatingly big when I
> first saw it :-) but it's actually pretty clear.
>
> You don't need to install bzr on the server if you're using ftp or
> sftp.
>
> The path in the url starts at the machine's root directory. To get to
> say public_html in your home directory you need
> sftp://example.com/~/public_html
>
> Your use of push is correct
>
> You might want to look at https://launchpad.net/bzr-upload if you want
> people to be able to see the contents of the branch in a web server.
>
> http://brianna.laugher.id.au/blog/20/using-bzr-for-developing-a-web-
> app
> might help
>
> hth, feel free to ask again
>
> --
> If this answers your question, please go to the following page to
> let us
> know that it is solved:
> https://answers.edge.launchpad.net/bzr/+question/104081/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.edge.launchpad.net/bzr/+question/104081
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Ian Clatworthy (ian-clatworthy) said :
#3

James,

It looks like this question is now solved. If not, please let us know what bits you still need assistance with.

Revision history for this message
Martin Pool (mbp) said :
#4

On 20 March 2010 00:00, James Dean <email address hidden> wrote:
> Question #104081 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/104081
>
>    Status: Answered => Open
>
> James Dean is still having a problem:
> Hi Martin,
> Ha!  I got a push to work!  Thanks for your help.

You're welcome.

> Duncan McGreggor has been helping me offline, and his examples
> correctly showed both ways you mentioned:
>        - Full path from root
>        - Use of ~ to indicate home directory, as in ~$USER
> However, I did not pick up on that key point somehow :-(

https://code.edge.launchpad.net/~mbp/bzr/doc/+merge/21820 tries to
make that more clear, please comment on it to let us know if it would
have helped.
> For SMB, there's this ticket (marked as a duplicate of the one above,
> but it has some more info):
>  https://bugs.edge.launchpad.net/bzr/+bug/31006

Hi,

The limit we have there with some network drives is that we cannot
store working directories on them. You can store repositories that
don't have trees, eg with

bzr init-repo --no-trees /some/path
bzr init /some/path/trunk
bzr checkout /some/path/trunk ~/trunk

--
Martin <http://launchpad.net/~mbp/>

Can you help with this problem?

Provide an answer of your own, or ask James Dean for more information if necessary.

To post a message you must log in.