学会使用码云管理文件
来源:互联网 发布:java classpath jar包 编辑:程序博客网 时间:2024/05/17 19:19
使用码云带来的好处:
- 代码共享
- 文件恢复
- 源码维护
- 版本控制
常见版本控制系统有Git、SVN、CVS、Git、Mercurial,目前主流使用的最多的就是git和svn,下面是这两种版本控制系统的比较:
- GIT是分布式的,SVN是集中式管理;
- GIT把内容按元数据方式增量存储,而SVN是按文件; <.svn .git >
- GIT分支和SVN的分支不同;
- GIT的内容完整性要优于SVN:
- git内容存储使用的是SHA-1哈希算法;
- SVN有一个全局的整数编号,而git则是一个SHA-1值作编号:
- SVN控制粒度可以到某个目录(当然很少这样做);而git一般是整个项目;
一、创建项目
1. 点击“+”->"新建项目" 2. 填写归属->填写名称->路径自动匹配->介绍(非必填)->选择程序语言(如C)->添加.gitignore->加密方式(如GPL v2)->相应填写是否公开->保存 3. (可选)开启svn访问:点进项目->管理->基本设置->启用svn访问
二、公钥管理
开发者向码云版本库写入最常用到的协议是 SSH 协议,因为 SSH 协议使用公钥认证,可以实
现无口令访问,而若使用 HTTPS 协议每次身份认证时都需要提供口令。
1.若服务器没有安装git服务,首先安装
[root@VM_83_82_redhat ~]# yum install git git-gui
2.对git进行全局配置
[yanhuan@VM_83_82_redhat ~]$ git config --global user.name"yanhuan"[yanhuan@VM_83_82_redhat ~]$ git config --global user.email"*****@foxmail.com"//用户名和邮箱应为自己实际姓名而非登录名
3.生成SSH秘钥
[yanhuan@VM_83_82_redhat ~]$ ssh-keygen -t rsa -C "*****@foxmail.com" //对应上方邮箱Generating public/private rsa key pair.Enter file in which to save the key (/home/yanhuan/.ssh/id_rsa): //选择秘钥保存路径Created directory '/home/yanhuan/.ssh'. Passphrases do not match. Try again.Enter passphrase (empty for no passphrase): //linux账号的密码Enter same passphrase again: Your identification has been saved in /home/yanhuan/.ssh/id_rsa.Your public key has been saved in /home/yanhuan/.ssh/id_rsa.pub.The key fingerprint is:3b:2b:69:61:f1:40:77:c0:3a:ff:e8:07:3f:58:1c:cd *****@foxmail.comThe key's randomart image is:+--[ RSA 2048]----+| ... || . o . || . o . o || = . E || *S. . || o +.o || . ooB || + oo= || . oo. . |+-----------------+
4.上传秘钥到码云
[yanhuan@VM_83_82_redhat ~]$ cat ~/.ssh/id_rsa.pub //查看秘钥文件ssh-rsa AAAA************705R2UZ ******@foxmail.com
设置->SSH公钥->添加
5.测试是否连上SVN
[yanhuan@VM_83_82_redhat ~]$ ssh -T git@git.oschina.netThe authenticity of host 'git.oschina.net (120.55.226.24)' can't be established.ECDSA key fingerprint is 27:e5:d3:f7:2a:9e:eb:6c:93:cd:1f:c1:47:a3:54:b1.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'git.oschina.net,120.55.226.24' (ECDSA) to the list of known hosts.Enter passphrase for key '/home/yanhuan/.ssh/id_rsa': //linux密码Welcome to Gitee.com, yanhuan! //成功[yanhuan@VM_83_82_redhat ~]$
三、下载
1.git下载
[yanhuan@VM_83_82_redhat ~]$ git clone git@gitee.com:************.gitCloning into 'FL2440KaiFaBan'...The authenticity of host 'gitee.com (120.55.226.24)' can't be established.ECDSA key fingerprint is 27:e5:d3:f7:2a:9e:eb:6c:93:cd:1f:c1:47:a3:54:b1.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'gitee.com' (ECDSA) to the list of known hosts.Enter passphrase for key '/home/yanhuan/.ssh/id_rsa': remote: Counting objects: 4, done.remote: Compressing objects: 100% (3/3), done.remote: Total 4 (delta 0), reused 0 (delta 0)Receiving objects: 100% (4/4), 6.93 KiB | 0 bytes/s, done. //git下载成功
2.svn下载
注意: 在码云上使用git管理的项目,svn不能管理空文件夹,只能管理文件:
[root@VM_83_82_redhat ~]# yum install subversion //首先要有svn[yanhuan@VM_83_82_redhat ~]$ svn co svn://gitee.com/********** //svn下载地址Authentication realm: <svn://gitee.com:3690> gitee.comPassword for 'yanhuan': //linux密码Authentication realm: <svn://gitee.com:3690> gitee.comUsername: *******@qq.com //码云注册邮箱Password for '********@qq.com': //码云密码Authentication realm: <svn://gitee.com:3690> gitee.comUsername: ******@qq.comPassword for '*******@qq.com': Store password unencrypted (yes/no)? yes C FL2440KaiFaBan/LICENSE C FL2440KaiFaBan/README.mdChecked out revision 1. //revision 1下载成成功[yanhuan@VM_83_82_redhat ~]$ ^C[yanhuan@VM_83_82_redhat ~]$ lsFL2440KaiFaBan[yanhuan@VM_83_82_redhat ~]$ lsFL2440KaiFaBan[yanhuan@VM_83_82_redhat ~]$ ls FL2440KaiFaBan/LICENSE README.md
四、git上传
[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ git config --global user.name "yanhuan" [yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ git config --global user.email "*******@foxmail.com"[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ ls crosstool/build.sh[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ git add crosstool/ //git上传crosstoll[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ git commit -m"Add crosstool build shell script" //注释[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ git push //push上码云Enter passphrase for key '/home/yanhuan/.ssh/id_rsa': //linux密码Counting objects: 5, done.Compressing objects: 100% (3/3), done.Writing objects: 100% (4/4), 611 bytes | 0 bytes/s, done.Total 4 (delta 0), reused 0 (delta 0)To git@gitee.com:yanyanhuan/FL2440KaiFaBan.git e172c5b..d442979 master -> master
[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ git checkout . //git同步下载
五、svn上传
[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ svn add crosstool/ //svn上传crosstoolA crosstoolA crosstool/build.sh[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ svn ci -m"Add crosstool build shell script" //注释
[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ svn diff //比较
[yanhuan@VM_83_82_redhat FL2440KaiFaBan]$ svn up //svn同步
阅读全文
0 0
- 学会使用码云管理文件
- 学会蒲公英Bug管理云的使用
- 学会使用ui文件
- 七天学会时间管理
- 学会去管理时间
- 学会去管理时间
- 学会去管理时间
- 学会时间管理
- 使用logrotate 管理日志文件
- 树莓派上使用SFTP管理文件
- IOS 文件管理,基础使用
- 半个月学会linux管理
- 7天学会管理时间
- 情绪管理---学会控制情绪
- 七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理
- 七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理
- 七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理
- 七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理
- Tobii:眼球追踪技术能够提升制造行业安全性
- 架构师应该是一种角色,而不是一个职位
- xfs文件系统修复方法
- cocos2D—X锚点概念
- 吴恩达(Andrew Ng)深度学习工程师笔记
- 学会使用码云管理文件
- JVM结构、GC工作机制详解
- Hadoop 基本概念
- 搭建memcached集群memcached+magent+repcache
- 超全总结 | 阿里电商故障治理和故障演练实践
- struts模型驱动和属性驱动冲突的问题
- Linux-002 用 CentOS 7 打造合适的科研环境
- Thread之sleep方法
- 连着面试30多次仍然失败的体会...