1. 程式人生 > >使用git 提交筆記

使用git 提交筆記

使用 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] ~]#
  1. 生成公鑰 技術分享

  2. 把公鑰添加進去 改個名字git test

  3. 再返回到git網頁那 技術分享

  4. 復制這段地址

  5. 再去終端下執行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 提交筆記