linux码云使用说明

原文地址https://blog.csdn.net/liushunCSDNblog/article/details/78369353

一、码云公钥管理

        开发者向码云版库写入到的协议是SSH协议,因为SSH协议使用公钥认证,可以实现无口令访问,而若使用HTTPS协议每次身份认证时都需要提供口令。

1、Linux上对Git进行全局配置 

该配置只需做一次且对该Linux主机上所有Git管理项目生效:

[liushun@centos6 ~]$ git config --global user.name"liushun"

[liushun@centos6 ~]$ git config --global user.email"1710275579@qq.com"

2、Linux上生成SSH key:

[liushun@centos6 ~]$ ssh-keygen -t rsa -C "1710275579@qq.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/home/liushun/.ssh/id_rsa):[回车]

Created directory '/home/liushun/.ssh'.

Enter passphrase (empty for no passphrase):[回车]

Enter same passphrase again:[回车]

Your identification has been saved in /home/liushun/.ssh/id_rsa.    #私钥

Your public key has been saved in /home/liushun/.ssh/id_rsa.pub.    #公钥

The key fingerprint is:

aa:a6:c6:fd:26:1e:95:c9:77:68:d4:ac:2c:2d:bc:e31710275579@qq.com

The key's randomart image is:

+--[ RSA 2048]----+

|                 |

|         o       |

|        . o      |

|     o * o       |

|      O S .      |

|     . B .       |

| . .. +          |

|  o ++..         |

| ..+o+E          |

+-----------------+

3、上传public key:

查看public key 并拷贝,将他添加到码云个人账号的SSH公钥里:

[liushun@centos6 ~]$ cat ~/.ssh/id_rsa.pub


ssh-rsa ..............== 1710275579@qq.com    中间省略

4、公钥添加测试:

[liushun@centos6 ~]$ ssh -T git@git.oschina.net

Welcome to Gitee.com, liushun!

5、git下载测试:

[liushun@centos6 ~]$ git clone git@gitee.com:YouMengXiangDeMiao/FL2440.git

Initialized empty Git repository in /home/liushun/FL2440/.git/

The authenticity of host 'gitee.com (120.55.226.24)' can't be established.

RSA key fingerprint is e3:ee:82:78:fb:c0:ca:24:65:69:ba:bc:47:24:6f:d4.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'gitee.com' (RSA) to the list of known hosts.

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.95 KiB, done.

[liushun@centos6 ~]$ ls  ls看看文件已经下下来了

FL2440

[liushun@centos6 ~]$ ls FL2440/

LICENSE  README.md

6、SVN下载测试:

[liushun@centos6 ~]$ svn co svn://gitee.com/YouMengXiangDeMiao/FL2440 --username=1710275579@qq.com

Authentication realm: <svn://gitee.com:3690>gitee.com

Password for '1710275579@qq.com':   #输入码云登录密码

-----------------------------------------------------------------------

ATTENTION!  Your password for authentication realm:

   <svn://gitee.com:3690>gitee.com

can only be stored to disk unencrypted!  You are advised to configure

your system so that Subversion can store passwords encrypted, if

possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value

of the 'store-plaintext-passwords' option to either 'yes' or 'no' in

'/home/liushun/.subversion/servers'.

-----------------------------------------------------------------------

Store password unencrypted (yes/no)? yes    

-----------------------------------------------------------------------

ATTENTION!  Your password for authentication realm:

   <svn://gitee.com:3690>gitee.com

can only be stored to disk unencrypted!  You are advised to configure

your system so that Subversion can store passwords encrypted, if

possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value

of the 'store-plaintext-passwords' option to either 'yes' or 'no' in

'/home/liushun/.subversion/servers'.

-----------------------------------------------------------------------

Store password unencrypted (yes/no)? yes

A    FL2440/LICENSE

A    FL2440/README.md

Checked out revision 1.

二、Linux上的git基本操作

1、本地clone码云上的项目:

[liushun@centos6 ~]$ mkdir gitee

[liushun@centos6 ~]$ cd gitee/

[liushun@centos6 gitee]$ ls

[liushun@centos6 gitee]$ mkdir iot-yun

[liushun@centos6 gitee]$ cd iot-yun/

[liushun@centos6 iot-yun]$ git clone git@gitee.com:YouMengXiangDeMiao/FL2440.git

Initialized empty Git repository in /home/liushun/gitee/iot-yun/FL2440/.git/

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.95 KiB, done.

[liushun@centos6 iot-yun]$ ls

FL2440

[liushun@centos6 iot-yun]$ ls FL2440/

LICENSE  README.md   #文件已经下下来了

2、创建FL2440项目源码结构:

[liushun@centos6 ~]$ cd FL2440

[liushun@centos6 FL2440]$ ls

LICENSE  README.md

[liushun@centos6 FL2440]$ mkdir -p {crosstool,linux/{kernel,rootfs},driver,3rdparty,program,images}

[liushun@centos6 FL2440]$ ls

3rdparty  crosstool  driver  images  LICENSE  linux  program  README.md

[liushun@centos6 FL2440]$

3、本地创建文件并提交服务器;

注意:git不能管理文件夹,只能管理文件

[liushun@centos6 FL2440]$ cd crosstool/

[liushun@centos6 crosstool]$ vim build.sh

#!/bin/bash

#This shell script used to downlaod crosstool-ng install and compile it for arm920tCRO

SSTOOL=crosstool-ng-centos-LingYUn-v1.0.0.bin

if[!-f${CROSSTOOL}];then

        wget ftp://master.iot-yun.com/linux_tools/${CROSSTOOL}

        sed -i -e "s|^sup_arch=.*|sup_arch=(\"\",\"arm920t\")|g" crosstool-ng centos-L

ingyun-v1.0.0.bin

fi

chmod a+x ${CROSSTOOL}

./${CROSSTOOL}

[liushun@centos6 crosstool]$ ls

build.sh

[liushun@centos6 crosstool]$ chmod a+x build.sh

[liushun@centos6 crosstool]$ cd ..

 SVN提交新创建的文件到服务器

[liushun@centos6 FL2440]$ ls

3rdparty  crosstool  driver  images  LICENSE  linux  program  README.md

[liushun@centos6 FL2440]$ svn add crosstool/

A         crosstool

A         crosstool/build.sh

[liushun@centos6 FL2440]$ svn ci -m"Add crosstool biuld shell script"

Adding         crosstool

Adding         crosstool/build.sh

Transmitting file data .

Committed revision 2.   #文件上传成功

4、文件修改提交

[liushun@centos6 FL2440]$ ls

3rdparty  crosstool  driver  images  LICENSE  linux  program  README.md

[liushun@centos6 FL2440]$ vim crosstool/build.sh     #用vim对文件进行修改,修改完退出vim

[liushun@centos6 FL2440]$ svn diff   

Index: crosstool/build.sh

===================================================================

--- crosstool/build.sh  (revision 2)

+++ crosstool/build.sh  (working copy)

@@ -6,3 +6,4 @@

fi

chmod a+x ${CROSSTOOL}

./${CROSSTOOL}

+hello world!    #我在原来的文件上加了hello world!

[liushun@centos6 FL2440]$ svn ci -m"update crosstool/biuld.sh,add author in the script"   #让服务器更新文件

Sending        crosstool/build.sh

Transmitting file data .

Committed revision 3.

[liushun@centos6 FL2440]$

然后再上网站,可以看到数据更新的信息!

5、文件删除后同步:

[liushun@centos6 FL2440]$ rm -rf crosstool/

[liushun@centos6 FL2440]$ ls

3rdparty  driver  images  LICENSE  linux  program  README.md  #可以看到crosstool整个文件夹都被删除

[liushun@centos6 FL2440]$ svn up

A    crosstool

A    crosstool/build.sh

Updated to revision 3.

[liushun@centos6 FL2440]$ ls crosstool/

build.sh             # 文件找回

[liushun@centos6 FL2440]$

---------------------

作者:有梦想的猫

来源:CSDN

原文:https://blog.csdn.net/liushunCSDNblog/article/details/78369353

版权声明:本文为博主原创文章,转载请附上博文链接!

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,921评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,635评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,393评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,836评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,833评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,685评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,043评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,694评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,671评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,670评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,779评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,424评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,027评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,984评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,214评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,108评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,517评论 2 343

推荐阅读更多精彩内容