上传项目: github管理尝试

过得几天,就准备开始我们的讨论会,讨论的结果希望有个地方大家都能维护,思来想去还是github靠谱。虽然网络偶尔抽个小疯,但无伤大雅。
项目创建非常容易,有代码维护权限的上传还是需要一些unix知识的。那就是public key的维护。
github给出了比较详细的代码管理说明,但是关于public key只有一个链接。这个key实际就是ssh时需要的两个key之一。可以由以下方式产生:
ssh-keygen -C '邮箱地址' -t rsa
最后私钥在 /home/用户名/.ssh/id_rsa
公钥在/home/用户名/.ssh/id_rsa.pub
将公钥中的内容复制增加到github的公钥管理,即在:https://github.com/account/ssh中增加另一个public key即可。
然后可以用下面的方法测试一下:
$test with ssh -v git@github.com
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [github ip] port 22.
debug1: Connection established.
debug1: identity file /home/username/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/username/.ssh/id_rsa-cert type -1
debug1: identity file /home/username/.ssh/id_dsa type -1
debug1: identity file /home/username/.ssh/id_dsa-cert type -1
debug1: identity file /home/username/.ssh/id_ecdsa type -1
debug1: identity file /home/username/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA public key
The authenticity of host 'github.com (github ip)' can't be established.
RSA key fingerprint is public key.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,github ip' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/username/.ssh/id_rsa
debug1: Remote: Forced command: gerve username
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Remote: Forced command: gerve username
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([github ip]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_COLLATE = en_US.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_CTYPE = en_US.UTF-8
PTY allocation request failed on channel 0
上传就非常容易了:
git config --global user.name "你的名字"
git config --global user.email 你的邮箱
git init
git add .
git commit -m 'first commit'
git remote add origin git@github.com:用户名/项目名.git
git push origin master
下附git命令的用法:
usage: git [--version] [--exec-path[=<path>]] [--html-path]
           [-p|--paginate|--no-pager] [--no-replace-objects]
           [--bare] [--git-dir=<path>] [--work-tree=<path>]
           [-c name=value] [--help]
           <command> [<args>]
The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find by binary search the change that introduced a bug
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   fetch      Download objects and refs from another repository
   grep       Print lines matching a pattern
   init       Create an empty git repository or reinitialize an existing one
   log        Show commit logs
   merge      Join two or more development histories together
   mv         Move or rename a file, a directory, or a symlink
   pull       Fetch from and merge with another repository or a local branch
   push       Update remote refs along with associated objects
   rebase     Forward-port local commits to the updated upstream head
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index
   show       Show various types of objects
   status     Show the working tree status
   tag        Create, list, delete or verify a tag object signed with GPG
See 'git help <command>' for more information on a specific command.
参考:

带壳小乌龟-Tortoise系版本管理客户端

TortoiseSVN

http://tortoisesvn.net/

TortoiseCVS

http://www.tortoisecvs.org/download.shtml

http://sourceforge.net/projects/tortoisecvs/

Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package ATL Security Update

http://www.microsoft.com/downloads/en/details.aspx?familyid=766a6af7-ec73-40ff-b072-9112bab119c2&displaylang=en#filelist”

TortoiseGit

http://code.google.com/p/msysgit/

http://code.google.com/p/tortoisegit/

TortoiseHg

http://tortoisehg.bitbucket.org/

免费的SCM环境SVN搭建

习惯已经养成。从2002年左右开始使用CVS,到2007年转向SVN,源码管理工具的使用,让工作更有条理。不过可惜的是,一直使用Tortoise系列的工具,TortoiseCVS, TortoiseSVN, TortoiseGit(用于git), TortoiseHG(用于Mercurial),命令的参数可是一个都记不全。可能只有co/clone吧。 继续阅读“免费的SCM环境SVN搭建”

Mercurial – 分布式版本控制系统

昨天进行了一下版本管理的总结。缘份看来无所不在啊。今天早上去code.google.com注册一个项目,发现版本管理里有2个选项,mercurial和svn。

根据来自developerWorks的资料

Mercurial 是一种轻量级分布式版本控制系统,采用 Python 语言实现,易于学习和使用,扩展性强。其是基于 GNU General Public License (GPL) 授权的开源项目。相对于传统的版本控制,具有如下优点:

  • 更轻松的管理。传统的版本控制系统使用集中式的 repository,一些和 repository相关的管理就只能由管理员一个人进行。由于采用了分布式的模型,Mercurial 中就没有这样的困扰,每个用户管理自己的 repository,管理员只需协调同步这些repository。
  • 更健壮的系统。分布式系统比集中式的单服务器系统更健壮,单服务器系统一旦服务器出现问题整个系统就不能运行了,分布式系统通常不会因为一两个节点而受到影响。
  • 对网络的依赖性更低。由于同步可以放在任意时刻进行,Mercurial 甚至可以离线进行管理,只需在有网络连接时同步。

使用python开发,这个我喜欢。需要研究的内容很多。git, mercurial。

软件版本管理或称配置管理

今天常姐姐问道关于版本管理的问题。以前比较常用的是cvs,有一段时间没有用了。原因也没有什么,见异思迁了。因为好些人推荐说svn好。好就好,好俺就敢用。所以一直是svn。反正也没出过什么问题,用着不错。就是客户端那个tortoisesvn三天两头的版本更新让人有点不爽。有好几个版本跳过了,反正用得很好。我服务器那端也没更新过呢。如果不用tortoisesvn,Windows用命令行有点感觉别扭。

向她推荐了知名的CruiseControl,她老人家言道Java的就是不喜欢。女人呐,喜好什么东西的感觉真是重要。以后要是从事商业活动这个可是要记在心中了。

今天晚上也是跟版本管理有缘份,看到之前关注过的一个东西用的是一个git的源,这就让人十分感兴趣了。加个linus兄也是推荐,再次跟风。看看git的内容。

ubuntu上比较容易:

$git

login as: nio
nio@192.168.0.7’s password:
Access denied
nio@192.168.0.7’s password:
Linux nio-laptop 2.6.24-24-386 #1 Wed Apr 15 15:13:41 UTC 2009 i686
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
Last login: Tue Jun 23 19:50:48 2009 from 192.168.0.4
nio@nio-laptop:~$ sudo apt-get install git
[sudo] password for nio:
正在读取软件包列表… 完成
正在分析软件包的依赖关系树
读取状态信息… 完成
已经不需要下列自动安装的软件包:
libdns32 linux-headers-2.6.24-17-generic libxmlsec1-gnutls libisc32
linux-headers-2.6.24-17
使用 ‘apt-get autoremove’ 来删除它们。
下列【新】软件包将被安装:
git
共升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 19 个软件未被升级。
需要下载 266kB 的软件包。
操作完成后,会消耗掉 1016kB 的额外磁盘空间。
获取:1 http://archive.ubuntu.com hardy/universe git 4.3.20-12 [266kB]
下载 266kB,耗时 4s (57.4kB/s)
选中了曾被取消选择的软件包 git。
(正在读取数据库 … 系统当前总共安装有 291462 个文件和目录。)
正在解压缩 git (从 …/git_4.3.20-12_i386.deb) …
正在设置 git (4.3.20-12) …
nio@nio-laptop:~$ git
程序 ‘git’ 尚未安装。  您可以通过输入以下命令安装:
sudo apt-get install git-core
-bash: git:找不到命令
nio@nio-laptop:~$ sudo apt-get install git-core
正在读取软件包列表… 完成
正在分析软件包的依赖关系树
读取状态信息… 完成
已经不需要下列自动安装的软件包:
libdns32 linux-headers-2.6.24-17-generic libxmlsec1-gnutls libisc32
linux-headers-2.6.24-17
使用 ‘apt-get autoremove’ 来删除它们。
将会安装下列额外的软件包:
libdigest-sha1-perl liberror-perl
建议安装的软件包:
git-arch git-cvs git-daemon-run git-doc git-email git-gui git-svn gitk
gitweb
下列【新】软件包将被安装:
git-core libdigest-sha1-perl liberror-perl
共升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 19 个软件未被升级。
需要下载 3129kB 的软件包。
操作完成后,会消耗掉 6861kB 的额外磁盘空间。
您希望继续执行吗?[Y/n]
获取:1 http://archive.ubuntu.com hardy/main libdigest-sha1-perl 2.11-2 [24.7kB]
获取:2 http://archive.ubuntu.com hardy/main liberror-perl 0.17-1 [23.8kB]
获取:3 http://archive.ubuntu.com hardy-updates/main git-core 1:1.5.4.3-1ubuntu2.1 [3080kB]
下载 3129kB,耗时 18s (171kB/s)
选中了曾被取消选择的软件包 libdigest-sha1-perl。
(正在读取数据库 … 系统当前总共安装有 291547 个文件和目录。)
正在解压缩 libdigest-sha1-perl (从 …/libdigest-sha1-perl_2.11-2_i386.deb) …
选中了曾被取消选择的软件包 liberror-perl。
正在解压缩 liberror-perl (从 …/liberror-perl_0.17-1_all.deb) …
选中了曾被取消选择的软件包 git-core。
正在解压缩 git-core (从 …/git-core_1%3a1.5.4.3-1ubuntu2.1_i386.deb) …
正在设置 libdigest-sha1-perl (2.11-2) …
正在设置 liberror-perl (0.17-1) …
正在设置 git-core (1:1.5.4.3-1ubuntu2.1) …
nio@nio-laptop:~$ git
usage: git [–version] [–exec-path[=GIT_EXEC_PATH]] [-p|–paginate|–no-pager] [–bare] [–git-dir=GIT_DIR] [–work-tree=GIT_WORK_TREE] [–help] COMMAND [ARGS]
The most commonly used git commands are:
add        Add file contents to the index
bisect     Find the change that introduced a bug by binary search
branch     List, create, or delete branches
checkout   Checkout and switch to a branch
clone      Clone a repository into a new directory
commit     Record changes to the repository
diff       Show changes between commits, commit and working tree, etc
fetch      Download objects and refs from another repository
grep       Print lines matching a pattern
init       Create an empty git repository or reinitialize an existing one
log        Show commit logs
merge      Join two or more development histories together
mv         Move or rename a file, a directory, or a symlink
pull       Fetch from and merge with another repository or a local branch
push       Update remote refs along with associated objects
rebase     Forward-port local commits to the updated upstream head
reset      Reset current HEAD to the specified state
rm         Remove files from the working tree and from the index
show       Show various types of objects
status     Show the working tree status
tag        Create, list, delete or verify a tag object signed with GPG
nio@nio-laptop:~$ git –help
usage: git [–version] [–exec-path[=GIT_EXEC_PATH]] [-p|–paginate|–no-pager] [–bare] [–git-dir=GIT_DIR] [–work-tree=GIT_WORK_TREE] [–help] COMMAND [ARGS]
The most commonly used git commands are:
add        Add file contents to the index
bisect     Find the change that introduced a bug by binary search
branch     List, create, or delete branches
checkout   Checkout and switch to a branch
clone      Clone a repository into a new directory
commit     Record changes to the repository
diff       Show changes between commits, commit and working tree, etc
fetch      Download objects and refs from another repository
grep       Print lines matching a pattern
init       Create an empty git repository or reinitialize an existing one
log        Show commit logs
merge      Join two or more development histories together
mv         Move or rename a file, a directory, or a symlink
pull       Fetch from and merge with another repository or a local branch
push       Update remote refs along with associated objects
rebase     Forward-port local commits to the updated upstream head
reset      Reset current HEAD to the specified state
rm         Remove files from the working tree and from the index
show       Show various types of objects
status     Show the working tree status
tag        Create, list, delete or verify a tag object signed with GPG
nio@nio-laptop:~$

程序’git’尚未安装。您可以通过输入以下命令安装:

sudo apt-get install git-core

-bash: git: 找不到命令。

真是不错啊,我以前一直为apt-get那些别扭的软件包名感到头疼。现在好了。

$sudo apt-get install git-core

安装完毕。

相关的东西明天再看。

资料列举一下:

1. git的wiki说明

2. git的主站

3. TortoiseGit的项目地址

4. git的教程

5. svn-git的相关讨论

6.

又及,code.google.com今晚不知什么原因不好用了。本来想申请个地方放点开源代码的。希望明天恢复正常。