一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - 編程技術 - 手把手教你如何上傳代碼到Gitee服務器

手把手教你如何上傳代碼到Gitee服務器

2022-01-10 23:30一口Linux土豆居士 編程技術

不得不說,git是一個非常好用的代碼版本管理工具,本文手把手教大家如何將自己編寫的代碼上傳到Gitee。

手把手教你如何上傳代碼到Gitee服務器

之前編寫了幾個適合新手的小項目, 為方便大家學習和下載代碼, 決定把代碼上傳到gitee服務器。

不得不說,git是一個非常好用的代碼版本管理工具,

本文手把手教大家如何將自己編寫的代碼上傳到Gitee。

1. 注冊賬號

打開網頁

  1. https://gitee.com/ 

手把手教你如何上傳代碼到Gitee服務器

點擊注冊, 輸入一個自己喜歡的域名,yikoulinux輸入手機號,驗證即可

手把手教你如何上傳代碼到Gitee服務器

點擊注冊并綁定 即可。

手把手教你如何上傳代碼到Gitee服務器

2.綁定微信

點擊頭像->設置

手把手教你如何上傳代碼到Gitee服務器

手把手教你如何上傳代碼到Gitee服務器

然后會彈出二維碼, 用自己的微信掃描二維碼即可。

3. 綁定郵箱

后續版本管理操作需要綁定郵箱才能繼續操作。

點擊頭像->設置

手把手教你如何上傳代碼到Gitee服務器

點擊 左邊郵箱管理->新增然后輸入剛才設置的gitee登錄密碼

手把手教你如何上傳代碼到Gitee服務器

正確會進入下面頁面, 輸入自己的郵箱(一口君用的QQ郵箱)

手把手教你如何上傳代碼到Gitee服務器

點擊確定

手把手教你如何上傳代碼到Gitee服務器

然后登錄自己郵箱,點擊對應的鏈接即可。

手把手教你如何上傳代碼到Gitee服務器

4. 新建倉庫

點擊頭像左側的+ -> 新建倉庫

手把手教你如何上傳代碼到Gitee服務器

輸入名稱以及開源許可證等。

手把手教你如何上傳代碼到Gitee服務器

點擊創建即可。

5. clone克隆倉庫到本地

復制倉庫鏈接:

手把手教你如何上傳代碼到Gitee服務器

進入ubuntu 如果沒有安裝git,可以執行以下命令安裝git

  1. sudo apt-get install git 

配置git全局環境

  1. git config --global user.name "yikoulinux" 
  2. git config --global user.email "[email protected]" 

修改commit默認打開的文本編輯工具

  1. git config --global core.editor "vim" 

開始克隆:

  1. root@ubuntu:/home/peng/work# git clone https://gitee.com/yikoulinux/encryption.git 
  2. Cloning into 'encryption'... 
  3. remote: Enumerating objects: 4, done. 
  4. remote: Counting objects: 100% (4/4), done. 
  5. remote: Compressing objects: 100% (4/4), done. 
  6. remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 
  7. Unpacking objects: 100% (4/4), done. 
  8. Checking connectivity... done. 

查看克隆下來的文件夾

  1. root@ubuntu:/home/peng/work# ls 
  2. encryption 
  3. root@ubuntu:/home/peng/work# cd encryption/ 
  4. root@ubuntu:/home/peng/work/encryption# ls 
  5. LICENSE 

查看git log

  1. root@ubuntu:/home/peng/work/encryption# git log 
  2. commit 5e0d6d12afb34a8082c6ef60f34f6e615c99746e 
  3. Author: 一口Linux <10221187+yikoulinux@user.noreply.gitee.com> 
  4. Date:   Tue Dec 21 13:57:19 2021 +0000 
  5.  
  6.     Initial commit 

拷貝代碼到當前目錄

  1. root@ubuntu:/home/peng/work/encryption# ls 
  2. key.c  key.h  LICENSE  main.c  README.md    

其中README.md是文檔說明,采用Markdown格式編寫。

添加源文件到本地倉庫:

  1. root@ubuntu:/home/peng/work/encryption# git add * 
  2. root@ubuntu:/home/peng/work/encryption# git status 
  3. On branch master 
  4. Your branch is up-to-date with 'origin/master'
  5. Changes to be committed
  6.   (use "git reset HEAD <file>..." to unstage) 
  7.  
  8.  modified:   LICENSE 
  9.  new file:   README.md 
  10.  new file:   key.c 
  11.  new file:   key.h 
  12.  new file:   main.c 
  13.   
  14. Changes not staged for commit
  15.   (use "git add <file>..." to update what will be committed
  16.   (use "git checkout -- <file>..." to discard changes in working directory) 
  17.  
  18.  modified:   .gitignore 

執行commit

  1. root@ubuntu:/home/peng/work/encryption# git commit 

添加commit 的 log信息【此時編輯工具是vim】

手把手教你如何上傳代碼到Gitee服務器

上傳到服務器:

  1. root@ubuntu:/home/peng/work/encryption# git push 
  2. warning: push.default is unset; its implicit value has changed in 
  3. Git 2.0 from 'matching' to 'simple'To squelch this message 
  4. and maintain the traditional behavior, use: 
  5.  
  6.   git config --global push.default matching 
  7.  
  8. To squelch this message and adopt the new behavior now, use: 
  9.  
  10.   git config --global push.default simple 
  11.  
  12. When push.default is set to 'matching', git will push local branches 
  13. to the remote branches that already exist with the same name
  14.  
  15. Since Git 2.0, Git defaults to the more conservative 'simple' 
  16. behavior, which only pushes the current branch to the corresponding 
  17. remote branch that 'git pull' uses to update the current branch. 
  18.  
  19. See 'git help config' and search for 'push.default' for further information. 
  20. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 
  21. 'current' instead of 'simple' if you sometimes use older versions of Git) 
  22.  
  23. Username for 'https://gitee.com': yikoulinux 
  24. Password for 'https://[email protected]':  
  25. Counting objects: 6, done. 
  26. Compressing objects: 100% (6/6), done. 
  27. Writing objects: 100% (6/6), 2.28 KiB | 0 bytes/s, done. 
  28. Total 6 (delta 0), reused 0 (delta 0) 
  29. remote: Powered by GITEE.COM [GNK-6.2] 
  30. To https://gitee.com/yikoulinux/encryption.git 
  31.    5e0d6d1..484d5d4  master -> master 

其中會要求輸入用戶名(開頭設置的名字yikoulinux)密碼,密碼輸入時不會回顯。

最終在gitee上顯示結果:

手把手教你如何上傳代碼到Gitee服務器

這樣我們就成功的將本地代碼上傳到服務器了。

6. 常用git命令

  1. git clone 項目地址  拉項目 
  2. git pull    拉代碼 
  3. git push  提交到倉庫 
  4. git init 指令初始化一個git倉庫 
  5. git add .添加文件 
  6. git commit -m "注釋"提交至倉庫。 
  7. git remote add origin https://git.oschina.net/你的用戶名/項目名. 
  8. git,git push origin master即可完成推送 
  9. git checkout master   切換到master分支 

7. 如果不想每次都輸入用戶名密碼可以

(1)生成ssh密鑰

  1. ssh-keygen -C '[email protected]' -t rsa 

會在用戶目錄~/.ssh/下建立相應的密鑰文件。如果是管理員創建在目錄/root/.ssh/下。

(2)上傳公鑰

使用命令cd ~/.ssh進入~/.ssh文件夾,輸入

  1. cat id_rsa.pub 

打開id_rsa.pub文件,復制其中所有內容。接著訪問git網頁,點擊SSH公鑰,標題欄可以隨意輸入,公鑰欄把剛才復制的內容粘貼進去。

手把手教你如何上傳代碼到Gitee服務器

此外,一口君還創建了一個基于Linux的聊天室的開源項目, 基功能包括登錄、注冊、公聊、私聊、數據庫、數據加密等功能。其他功能后續會陸續完善。

https://gitee.com/yikoulinux/chat.git

原文地址:https://mp.weixin.qq.com/s/taKtlOGSQKjVBJUMRJzNng

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 午夜国产精品 | 婷婷激情综合五月天 | 亚洲精品免费观看 | 日韩免费视频播放 | 免费视频网 | 热伊人99re久久精品最新地 | 精油按摩日本 | 日本熟hdx| 国产在视频 | 久久国产乱子伦精品免费不卡 | 美女视频久久 | 欧美国产影院 | 欧美美女被艹 | hd在线观看免费高清视频 | 国产麻豆精品入口在线观看 | 日本高清视频在线免费观看 | 91成人免费观看 | 男人的天堂视频在线 | 免费全看男女拍拍拍的视频 | 久久精品亚洲精品国产欧美 | 九九精品国产兔费观看久久 | 亚洲好视频 | 女人和男人搞鸡 | 538精品视频| 动漫人物差差差动漫人物免费观看 | 深夜激情网站 | 国产精品视频二区不卡 | 日剧整部剧护妻狂魔免费观看全集 | 精品在线免费观看 | 波多野结衣伦理在线观看 | 亚洲国产精品无码中文字幕 | 欧美福利二区 | 91精品啪在线观看国产线免费 | 日韩在线 中文字幕 | 91天堂在线视频 | chinese国产老太性 | 91对白在线 | 国产成+人+综合+亚洲不卡 | 国产精品久久久久久久福利院 | 无遮挡免费h肉动漫在线观看 | 美女被吸乳老师羞羞漫画 |