1. I have create a local directory, and made some sub-directories and file in it.
  2. registered by project on code.google.com/hosting
  3. install Mercurial and did hg init
  4. copied the auto-generated password from Google, still don't know for what.

Now how do i upload files my local to the repository on Google. Tired googling a lot, almost all the information is available for SVN users.

Do i have to create a branch on mercurial first. I am sorry if it is too silly, but how do I create one, the site does say anything create or upload or add.

Can anyone please share, how he started/uploaded his project?


pgs is entirely correct. When you create a project at Google (or other hosting services), they will create a repository for you. You need to copy over your code, add it / commit (after tweaking .hgignore, of course!) and hg commit -Am "Inintial checkin of project"

If you try to push another repository that you create to Google, it will not work. This is because your newly created repository is not related to (derived from) the one that Google created for you. Since you don't have CLI access to Google, you can't do the usual work-around for unrelated pulls by cherry picking particular revisions.

This is frustrating when you already have a repository with history. In that case, you have to clone the empty Google repo, then hg pull (path / url to your repo) to get your revisions, then commit, then push. Good luck with that if you have extensive branches, be sure you have no unresolved heads before you push to Google.

This is why I host my own hg repos on my own site, much less hassle.

  • @tinkertim-- what is .hgignore for? Have you used wiki feature of googlecode locally for your any of your project, and pushed it to code.google. If yes then is there any wikiSyntax-toolbarAttached-editor available for working on wiki entries Jul 10 '09 at 17:59
  • @Vivek Sharma-- .hgignore is a file that tells Mercurial to ignore certain types of files described by expressions or a simple glob. I.e., you would want *.o *.out *~ *.rej in that file, so you don't acciddentally commit rubbish files.
    – Tim Post
    Jul 11 '09 at 3:28
  • I can't answer about Google Code (because I don't use it), but I can upload my repositories quite easily to bitbucket. Whenever I create a new project/repository at bitbucket, it is created empty. Since it is empty, it "hasn't born" yet, and thus will accept my local repository. Apr 8 '10 at 6:53
  • You can always push into an empty repository such as the one Google Code makes for you when you create a new repository on their site. Use hg push URL or edit the .hg/hgrc file first to update the default path there and use hg push. Dec 18 '11 at 10:54

From reading the help pages, I think you need to go to your project's Source page and clone the repository (instead of hg init). Then I believe you can checkin code, and hg push it up to google.

  • thanks pgs, for reading the pages and telling me. As i using any VCS/SCM for the first i could not related it. thanks indeed. Jul 10 '09 at 16:46

Actually, you can push into a Google Code repository without having to clone from it first. Either just do hg push http://$projectname.googlecode.com/hg from the local repo, or edit your .hg/hgrc and add a section like this:

default = http://$projectname.googlecode.com/hg

and then run hg push as usual.

  • This just works, why doesn't it have a higher rating? Jan 10 '13 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.