代码托管
github,google code,bitbucket
github private需要花钱,google code深奥的简洁,最后选择bitbucket;
bitbucket 无限的private仓库,好吧,最关键的是支持中文。。。。。
创建项目,git方式
设置SSH密钥
文字化就是:
1.在终端中运行ssh-keygen。 2.然后一路enter,直接到结束。不要理会中间的输入。 3 打开用户目录下.ssh/id_rsa.pub文件,复制其内容。
感觉很诡异,在终端配置了邮件跟用户,跟网站上的一样了,结果还提示
- senrsl@senrsl-desktop:~$ ssh-keygen
- Generating public/private rsa key pair.
- Enter file in which to save the key (/home/senrsl/.ssh/id_rsa):
- Created directory '/home/senrsl/.ssh'.
- Enter passphrase (empty for no passphrase):
- Enter same passphrase again:
- Your identification has been saved in /home/senrsl/.ssh/id_rsa.
- Your public key has been saved in /home/senrsl/.ssh/id_rsa.pub.
- The key fingerprint is:
- 3c:47:59:8e:6b:ad:85:54:c7:33:c9:b7:85:81:c9:f6 senrsl@senrsl-desktop
- The key's randomart image is:
- +--[ RSA 2048]----+
- | .o=o+ |
- | *=.B o|
- | =... +o|
- | . o + E. |
- | S = o |
- | + o |
- | . |
- | |
- | |
- +-----------------+
- senrsl@senrsl-desktop:~$ ssh -v
- OpenSSH_5.9p1 Debian-5ubuntu1.2, OpenSSL 1.0.1 14 Mar 2012
- usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
- [-D [bind_address:]port] [-e escape_char] [-F configfile]
- [-I pkcs11] [-i identity_file]
- [-L [bind_address:]port:host:hostport]
- [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
- [-R [bind_address:]port:host:hostport] [-S ctl_path]
- [-W host:port] [-w local_tun[:remote_tun]]
- [user@]hostname [command]
- senrsl@senrsl-desktop:~$ cd test/bitbucket/
- senrsl@senrsl-desktop:~/test/bitbucket$ ll
- 总用量 8
- drwxrwxr-x 2 senrsl senrsl 4096 5月 2 14:14 ./
- drwxrwxr-x 4 senrsl senrsl 4096 5月 2 14:14 ../
- senrsl@senrsl-desktop:~/test/bitbucket$ cd test
- senrsl@senrsl-desktop:~/test/bitbucket/test$ ll
- 总用量 8
- drwxrwxr-x 2 senrsl senrsl 4096 5月 2 14:15 ./
- drwxrwxr-x 3 senrsl senrsl 4096 5月 2 14:15 ../
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git init
- 程序"git"尚未安装。 您可以使用以下命令安装:
- sudo apt-get install git
- senrsl@senrsl-desktop:~/test/bitbucket/test$ sudo apt-get install git
- [sudo] password for senrsl:
- 正在读取软件包列表... 完成
- 正在分析软件包的依赖关系树
- 正在读取状态信息... 完成
- 下列软件包是自动安装的并且现在不需要了:
- liblaunchpad-integration1 indicator-status-provider-pidgin pidgin-data
- libgtkspell0
- 使用'apt-get autoremove'来卸载它们
- 将会安装下列额外的软件包:
- git-man liberror-perl
- 建议安装的软件包:
- git-daemon-run git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn
- git-email git-gui gitk gitweb
- 下列【新】软件包将被安装:
- git git-man liberror-perl
- 升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 38 个软件包未被升级。
- 需要下载 6,617 kB 的软件包。
- 解压缩后会消耗掉 15.2 MB 的额外空间。
- 您希望继续执行吗?[Y/n]y
- 获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main liberror-perl all 0.17-1 [23.8 kB]
- 获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise/main git-man all 1:1.7.9.5-1 [630 kB]
- 获取:3 http://cn.archive.ubuntu.com/ubuntu/ precise/main git i386 1:1.7.9.5-1 [5,963 kB]
- 下载 6,617 kB,耗时 4秒 (1,631 kB/s)
- Selecting previously unselected package liberror-perl.
- (正在读取数据库 ... 系统当前共安装有 180907 个文件和目录。)
- 正在解压缩 liberror-perl (从 .../liberror-perl_0.17-1_all.deb) ...
- Selecting previously unselected package git-man.
- 正在解压缩 git-man (从 .../git-man_1%3a1.7.9.5-1_all.deb) ...
- Selecting previously unselected package git.
- 正在解压缩 git (从 .../git_1%3a1.7.9.5-1_i386.deb) ...
- 正在处理用于 man-db 的触发器...
- 正在设置 liberror-perl (0.17-1) ...
- 正在设置 git-man (1:1.7.9.5-1) ...
- 正在设置 git (1:1.7.9.5-1) ...
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git init
- Initialized empty Git repository in /home/senrsl/test/bitbucket/test/.git/
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git remote add origin git@bitbucket.org:dcjz/test.git
- senrsl@senrsl-desktop:~/test/bitbucket/test$ echo "# This is my README" >> README.md
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git add REDEME.md
- fatal: pathspec 'REDEME.md' did not match any files
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git add README.md
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git commit -m "First commit. Adding a README"
- [master (root-commit) 7680e52] First commit. Adding a README
- Committer: senRsl <senrsl@senrsl-desktop.(none)>
- Your name and email address were configured automatically based
- on your username and hostname. Please check that they are accurate.
- You can suppress this message by setting them explicitly:
- git config --global user.name "Your Name"
- git config --global user.email you@example.com
- After doing this, you may fix the identity used for this commit with:
- git commit --amend --reset-author
- 1 file changed, 1 insertion(+)
- create mode 100644 README.md
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git push -u origin master
- The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
- RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
- Are you sure you want to continue connecting (yes/no)? ^C
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git push -u origin master
- The authenticity of host 'bitbucket.org (131.103.20.168)' can't be established.
- RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
- Are you sure you want to continue connecting (yes/no)? yes
- Warning: Permanently added 'bitbucket.org,131.103.20.168' (RSA) to the list of known hosts.
- Counting objects: 3, done.
- Writing objects: 100% (3/3), 249 bytes, done.
- Total 3 (delta 0), reused 0 (delta 0)
- To git@bitbucket.org:dcjz/test.git
- * [new branch] master -> master
- Branch master set up to track remote branch master from origin.
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git add .
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git commit -m 'version 1.0.0'
- [master 4bad3fd] version 1.0.0
- Committer: senRsl <senrsl@senrsl-desktop.(none)>
- Your name and email address were configured automatically based
- on your username and hostname. Please check that they are accurate.
- You can suppress this message by setting them explicitly:
- git config --global user.name "Your Name"
- git config --global user.email you@example.com
- After doing this, you may fix the identity used for this commit with:
- git commit --amend --reset-author
- 25 files changed, 183 insertions(+)
- create mode 100644 AndroidManifest.xml
- create mode 100644 bin/AndroidManifest.xml
- create mode 100644 bin/classes/com/dc/activity/CommonActivity.class
- create mode 100644 bin/classes/com/dc/activity/TestActivity.class
- create mode 100644 bin/classes/com/dc/test/BuildConfig.class
- create mode 100644 bin/classes/com/dc/test/R$attr.class
- create mode 100644 bin/classes/com/dc/test/R$drawable.class
- create mode 100644 bin/classes/com/dc/test/R$string.class
- create mode 100644 bin/classes/com/dc/test/R$style.class
- create mode 100644 bin/classes/com/dc/test/R.class
- create mode 100644 bin/jarlist.cache
- create mode 100644 gen/com/dc/test/BuildConfig.java
- create mode 100644 gen/com/dc/test/R.java
- create mode 100644 ic_launcher-web.png
- create mode 100644 libs/android-support-v4.jar
- create mode 100644 proguard-project.txt
- create mode 100644 project.properties
- create mode 100644 res/drawable-hdpi/ic_launcher.png
- create mode 100644 res/drawable-mdpi/ic_launcher.png
- create mode 100644 res/drawable-xhdpi/ic_launcher.png
- create mode 100644 res/drawable-xxhdpi/ic_launcher.png
- create mode 100644 res/values/strings.xml
- create mode 100644 res/values/styles.xml
- create mode 100644 src/com/dc/activity/CommonActivity.java
- create mode 100644 src/com/dc/activity/TestActivity.java
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git remote add origin git@bitbucket.org:dcjz/test.git
- fatal: remote origin already exists.
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git push origin master
- Counting objects: 48, done.
- Delta compression using up to 4 threads.
- Compressing objects: 100% (35/35), done.
- Writing objects: 100% (47/47), 631.72 KiB, done.
- Total 47 (delta 2), reused 0 (delta 0)
- To git@bitbucket.org:dcjz/test.git
- 7680e52..4bad3fd master -> master
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git config --list"
- > ^C
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git config -list
- error: did you mean `--list` (with two dashes ?)
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git config --list
- core.repositoryformatversion=0
- core.filemode=true
- core.bare=false
- core.logallrefupdates=true
- remote.origin.url=git@bitbucket.org:dcjz/test.git
- remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
- branch.master.remote=origin
- branch.master.merge=refs/heads/master
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git config --global user.name "senRsl DC"
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git config --global user.email senRsl@163.com
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git config --list
- user.name=senRsl DC
- user.email=senRsl@163.com
- core.repositoryformatversion=0
- core.filemode=true
- core.bare=false
- core.logallrefupdates=true
- remote.origin.url=git@bitbucket.org:dcjz/test.git
- remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
- branch.master.remote=origin
- branch.master.merge=refs/heads/master
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git config user.name
- senRsl DC
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git commit -a -m 'version 1.0.1'
- [master 89c671d] version 1.0.1
- 1 file changed, 1 insertion(+)
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git push origin master
- Warning: Permanently added the RSA host key for IP address '131.103.20.167' to the list of known hosts.
- Counting objects: 5, done.
- Delta compression using up to 4 threads.
- Compressing objects: 100% (2/2), done.
- Writing objects: 100% (3/3), 297 bytes, done.
- Total 3 (delta 1), reused 0 (delta 0)
- To git@bitbucket.org:dcjz/test.git
- 4bad3fd..89c671d master -> master
- senrsl@senrsl-desktop:~/test/bitbucket/test$ gedit ~/.hgrc
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git commit -a -m 'version 1.0.2'
- [master 3f9ba27] version 1.0.2
- 1 file changed, 1 insertion(+)
- senrsl@senrsl-desktop:~/test/bitbucket/test$ git push origin master
- Counting objects: 5, done.
- Delta compression using up to 4 threads.
- Compressing objects: 100% (3/3), done.
- Writing objects: 100% (3/3), 308 bytes, done.
- Total 3 (delta 1), reused 0 (delta 0)
- To git@bitbucket.org:dcjz/test.git
- 89c671d..3f9ba27 master -> master
- senrsl@senrsl-desktop:~/test/bitbucket/test$
于是就点创建别名进行绑定。。。。。。
好诡异的感觉。。。。
修改git config配置文件
查看当前配置:git config --list
修改你的标识(your identity)
创建相应目录,比方说test/test/
然后cd进去
新上传项目
git init //初始化修改本地文件上传
git add . //本地准备添加,"."是表示所有文件
git commit -m 'version 1.0.0' //引号里是说明信息
git remote add origin git@bitbucket.org:dcjz/test.git //这个应该是增加远端地址
git push origin master //上传发布
增加文件的时候
git add .
git commit -a -m 'version 1.0.3'
git push origin master
不是增加,只是修改的话
git commit -a -m 'version 1.0.3'
git push origin master
创建一个Tag
删除某个tag
从服务器下载项目
会新创建test文件夹,然后下载进去
trunk branches tags
主干 分支 标签
主干是标准版,日常开发;
分支,阶段性的release版本,客户定制版本;
tags目录一般是只读的,阶段性的发布版本,作为里程碑进行存档;
--
senRsl
2014-05-02 15:53
GMT+8 @Beijing Tongzhou
senRsl
2014-05-02 15:53
GMT+8 @Beijing Tongzhou
没有评论 :
发表评论