Sunday, June 7, 2015

Uploading Android Source Code to BitBucket

I am recently playing around with Android Source Code for a challenging project, because I need to customize the Android System to match requirements. Later to introduce version control, I would like to upload the code to BitBucket. Since I am a new user for BitBucket, so some problems are worth being recorded.

First of all, down the Android 4.4.2 source code from my cloud storage: http://pan.baidu.com/s/1c06iLXY Sorry, I am Chinese so this interface is in Chinese as well. But I think Google Translate would help. The folder is really huge, almost 4 GB size. So to post this folder to your Github or BitBucket repository, it requires to change the default post buffer size. By default, the post buffer is 1MB. Let us assume to change the buffer to 5GB. You can use command:

git config http.postBuffer 5368709120

The granularity is in Bytes, you can change the setting in the config file of .git directory instead. Both ways would work. Then I encountered the following strange error in push, which trapped me for a while:

error: RPC failed; result=56, HTTP code = 0
fatal: The remote end hung up unexpectedly

After some searches, I found there are types to interacting with repositories in BigBucket: HTTP and SSH. So I change the connecting type from HTTP to SSH:

git remote set-url origin <ssh url of repository>

Then I pushed again, but one error occurs:

Permission denied (publickey)
fatal: Could not read from remote repository.

Ahha, I forgot to setup the ssh key in my computer, so type

ssh-keygen

and Enter button three times. Then copy the public key in ~/.ssh/id_rsa.pub to the Deployment keys panel of Settings of the repository. Everything should work fine, but later I got error again:

conq: repository does not exist.
fatal: Could not read from remote repository.

This is because I pasted the SSH key to the wrong place. I deleted the stored ssh key in Deployment Keys panel and go to Profile -> Manage account -> SECURITY -> SSH keys, and added the ssh key here. Then push again, everything works fine and the code has been successfully uploaded into the repository of BitBucket.org.


No comments:

Post a Comment