首先打开 git.lishiming.net
注册好一个自己的账号之后
创建新的项目 new projects
填上项目名称
再打开一个这个git网页
点击setting 再找到SSH-keys
再去终端上 执行命令
[root@aminglinux-01 ~]# ssh-keygenGenerating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa already exists. Overwrite (y/n)? [root@aminglinux-01 ~]# cat .ssh/ authorized_keys id_rsa id_rsa.pub known_hosts [root@aminglinux-01 ~]# cat .ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCW/PEkjIUyw3wlut9KBXmKoxpsGFhF6JcP+LvHITzYWmwF2owhYUP91bRzyg3PAzJaOjDGKRzy/pHkdfPC24hVYEKBt5Ur8d8Hzh9QYIF4RZbtVI4YKtadjdUfNW2mbYc+7Ep+tiXI4tff8maovjhA3z28p5ZL8wChA5WtZdmhN0v7hYuj3fdJvHZr0Y9YZ6BHBnToblbSW/y9dZFH8UFwLV1gZ1CSONr5KizxMqmK2vQ6ZZPEm74iGSVAd4IdMxapyR+5c1QUnz8pAsVCpDpQZHqf6jxnl+U2Jf3HvMS7kWhKIQdqaRAwflny1DHIPiahUnxZ7vvVVJy4a0oEKUYJ root@aminglinux-01[root@aminglinux-01 ~]#
生成公钥
把公钥添加进去 改个名字git test
再返回到git网页那
复制这段地址
再去终端下执行git clone 命令
[root@aminglinux-01 ~]# [root@aminglinux-01 ~]# ls111 1_heard.txt 1.txt~ 234 3.txt anaconda-ks.cfg.1123 1_sorft.txt 1.txt.bak 2.txt.bak 4.txt biji.txt [root@aminglinux-01 ~]# cd /data/-bash: cd: /data/: 没有那个文件或目录 [root@aminglinux-01 ~]# mkdir /data/[root@aminglinux-01 ~]# cd /data/[root@aminglinux-01 data]# ls[root@aminglinux-01 data]# git clone ssh://git@106.3.32.67:14822/ch71smas/liurongluan.git正克隆到 'liurongluan'...warning: 您似乎克隆了一个空版本库。 [root@aminglinux-01 data]# [root@aminglinux-01 data]# lsliurongluan [root@aminglinux-01 data]# cd liurongluan[root@aminglinux-01 liurongluan]# ls[root@aminglinux-01 liurongluan]# ls -a. .. .git [root@aminglinux-01 liurongluan]# cd .git[root@aminglinux-01 .git]# lsbranches config description HEAD hooks info objects refs [root@aminglinux-01 .git]# cat config[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true[remote "origin"] url = ssh://git@106.3.32.67:14822/ch71smas/liurongluan.git fetch = +refs/heads/*:refs/remotes/origin/*[branch "master"] remote = origin merge = refs/heads/master [root@aminglinux-01 .git]#
再继续创建一个READ.md的文件
[root@aminglinux-01 .git]# cd ..[root@aminglinux-01 liurongluan]# vi README.md
进入vi 编辑
保存退出
然后把这个README.md 上传到服务端上来,因为现在仓库是空的,什么都没有,没有任何文件 代码
现在要把这个文件搞到服务端上去
[root@aminglinux-01 liurongluan]# git add .[root@aminglinux-01 liurongluan]# git commit -m "add smth"[master(根提交) 75eb7b9] add smth 1 file changed, 5 insertions(+) create mode 100644 README.md [root@aminglinux-01 liurongluan]# git push -u origin masterCounting objects: 3, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 334 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To ssh://git@106.3.32.67:14822/ch71smas/liurongluan.git * [new branch] master -> master 分支 master 设置为跟踪来自 origin 的远程分支 master。 [root@aminglinux-01 liurongluan]#
再去远程服务端上刷新下
已经完成了