使用git 提交笔记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用git 提交笔记相关的知识,希望对你有一定的参考价值。
使用git 提交笔记
首先打开 git.lishiming.net
注册好一个自己的账号之后
创建新的项目 new projects
填上项目名称
再打开一个这个git网页
点击setting 再找到SSH-keys
再去终端上 执行命令
[[email protected] ~]# 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)? [[email protected] ~]# cat .ssh/ authorized_keys id_rsa id_rsa.pub known_hosts [[email protected] ~]# cat .ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCW/PEkjIUyw3wlut9KBXmKoxpsGFhF6JcP+LvHITzYWmwF2owhYUP91bRzyg3PAzJaOjDGKRzy/pHkdfPC24hVYEKBt5Ur8d8Hzh9QYIF4RZbtVI4YKtadjdUfNW2mbYc+7Ep+tiXI4tff8maovjhA3z28p5ZL8wChA5WtZdmhN0v7hYuj3fdJvHZr0Y9YZ6BHBnToblbSW/y9dZFH8UFwLV1gZ1CSONr5KizxMqmK2vQ6ZZPEm74iGSVAd4IdMxapyR+5c1QUnz8pAsVCpDpQZHqf6jxnl+U2Jf3HvMS7kWhKIQdqaRAwflny1DHIPiahUnxZ7vvVVJy4a0oEKUYJ [email protected][[email protected] ~]#
生成公钥
把公钥添加进去 改个名字git test
再返回到git网页那
复制这段地址
再去终端下执行git clone 命令
[[email protected] ~]# [[email protected] ~]# 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 [[email protected] ~]# cd /data/-bash: cd: /data/: 没有那个文件或目录 [[email protected] ~]# mkdir /data/[[email protected] ~]# cd /data/[[email protected] data]# ls[[email protected] data]# git clone ssh://[email protected]:14822/ch71smas/liurongluan.git正克隆到 ‘liurongluan‘...warning: 您似乎克隆了一个空版本库。 [[email protected] data]# [[email protected] data]# lsliurongluan [[email protected] data]# cd liurongluan[[email protected] liurongluan]# ls[[email protected] liurongluan]# ls -a. .. .git [[email protected] liurongluan]# cd .git[[email protected] .git]# lsbranches config description HEAD hooks info objects refs [[email protected] .git]# cat config[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true[remote "origin"] url = ssh://[email protected]:14822/ch71smas/liurongluan.git fetch = +refs/heads/*:refs/remotes/origin/*[branch "master"] remote = origin merge = refs/heads/master [[email protected] .git]#
再继续创建一个READ.md的文件
[[email protected] .git]# cd ..[[email protected] liurongluan]# vi README.md
进入vi 编辑
保存退出
然后把这个README.md 上传到服务端上来,因为现在仓库是空的,什么都没有,没有任何文件 代码
现在要把这个文件搞到服务端上去
[[email protected] liurongluan]# git add .[[email protected] liurongluan]# git commit -m "add smth"[master(根提交) 75eb7b9] add smth 1 file changed, 5 insertions(+) create mode 100644 README.md [[email protected] 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://[email protected]:14822/ch71smas/liurongluan.git * [new branch] master -> master 分支 master 设置为跟踪来自 origin 的远程分支 master。 [[email protected] liurongluan]#
再去远程服务端上刷新下
已经完成了
以上是关于使用git 提交笔记的主要内容,如果未能解决你的问题,请参考以下文章