国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Linux|Centos|Ubuntu|系統(tǒng)進(jìn)程|Fedora|注冊(cè)表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務(wù)器之家 - 服務(wù)器系統(tǒng) - Centos - 在CentOS搭建Git服務(wù)器的詳細(xì)步驟

在CentOS搭建Git服務(wù)器的詳細(xì)步驟

2022-02-21 17:46TeslaChen Centos

本篇文章主要介紹了在CentOS搭建Git服務(wù)器的詳細(xì)步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

前言

我們可以GitHub發(fā)布一些開源代碼的公共倉庫,但對(duì)于私密倉庫就需要收費(fèi)了。公司內(nèi)部通常會(huì)搭建自己的Git服務(wù)器,我也通過在自己的服務(wù)器上搭建練習(xí)一下。

開始前先說一下服務(wù)器信息,這里是阿里云的CentOS 6.5 64位操作系統(tǒng)。

一 確認(rèn)服務(wù)器是否安裝Git

?
1
2
[root@iZ25r8k6ifuZ git]# rpm -qa git
git-1.7.1-3.el6_4.1.x86_64

這里也已經(jīng)安裝過了,如果沒有安裝可以用yum install git 安裝。

二 創(chuàng)建git用戶

這里你可以選擇新建一個(gè)用戶來測(cè)試,也可以直接使用你的root進(jìn)行以下操作。筆者也是看著資料一步一步來的,這里創(chuàng)建一個(gè)新用戶teslachen進(jìn)行操作。

?
1
2
[root@iZ25r8k6ifuZ ~]# useradd tesla
[root@iZ25r8k6ifuZ ~]# passwd tesla

更改用戶 tesla 的密碼 。

新的 密碼:

無效的密碼: 它沒有包含足夠的不同字符

無效的密碼: 過于簡(jiǎn)單

重新輸入新的 密碼:

passwd: 所有的身份驗(yàn)證令牌已經(jīng)成功更新。

注1:創(chuàng)建用戶權(quán)限不夠請(qǐng)加上sudo;

注2:設(shè)置用戶密碼太過簡(jiǎn)單的話會(huì)有提示,但依舊可以設(shè)置成功。

三 生成ssh公鑰

許多 Git 服務(wù)器都使用 SSH 公鑰進(jìn)行認(rèn)證。 為了向 Git 服務(wù)器提供 SSH 公鑰,如果某系統(tǒng)用戶尚未擁有密鑰,必須事先為其生成一份。

linux 可以在本機(jī)運(yùn)行ssh-keygen -t rsa生成密鑰,把.pub文件拷到服務(wù)器上。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@iZ25r8k6ifuZ ~]# su tesla
[tesla@iZ25r8k6ifuZ root]$ cd ~
[tesla@iZ25r8k6ifuZ ~]$ mkdir .ssh
[tesla@iZ25r8k6ifuZ ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/tesla/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tesla/.ssh/id_rsa.
Your public key has been saved in /home/tesla/.ssh/id_rsa.pub.
The key fingerprint is:
13:bf:75:ba:67:7f:0e:a0:47:7a:fe:25:bc:81:85:c3 tesla@iZ25r8k6ifuZ
The key's randomart image is:
+--[ RSA 2048]----+
|     |
|     |
|  .  |
|   o . . |
|  S . E o |
|   . O |
|   + = = .|
|   + .o.|
|   o+oo+|
+-----------------+
[tesla@iZ25r8k6ifuZ ~]$ cd .ssh/
[tesla@iZ25r8k6ifuZ .ssh]$ cat id_rsa.pub >> ~/.ssh/authorized_keys
exit

四 添加tesla到sudoers文件

tesla用戶現(xiàn)在對(duì)一些文件夾沒有操作權(quán)限,修改/etc/sudoers文件來改變他的權(quán)限。最高管理員用戶用下面命令打開。

?
1
[root@iZ25r8k6ifuZ ~]# visudo

然后我們?cè)趘im中找到下面這行

?
1
root ALL=(ALL) ALL

按i鍵開始插入,回車一下在下面一行加上

?
1
tesla ALL=(ALL) ALL

接著按下esc鍵,輸入 :wq ,回車保存退出

五 創(chuàng)建Git代碼倉庫

?
1
2
3
4
5
6
7
8
[root@iZ25r8k6ifuZ ~]# mkdir /teslaRepo
[root@iZ25r8k6ifuZ ~]# cd /teslaRepo/
[root@iZ25r8k6ifuZ teslaRepo]# sudo mkdir teslaProject.git
[root@iZ25r8k6ifuZ teslaRepo]# chown tesla:tesla /teslaRepo/
[root@iZ25r8k6ifuZ teslaRepo]# chown -R tesla:git /teslaRepo/
[root@iZ25r8k6ifuZ teslaRepo]# cd teslaProject.git/
[root@iZ25r8k6ifuZ teslaProject.git]# sudo git --bare init
Initialized empty Git repository in /teslaRepo/teslaProject.git/

這樣一個(gè)叫teslaProject得Git倉庫就創(chuàng)建好了

六 本地測(cè)試使用

你可以直接在服務(wù)器上進(jìn)行本地測(cè)試,也可以直接用你的電腦來測(cè)試。下面我是使用自己的MBP來進(jìn)行的測(cè)試。

?
1
2
3
4
5
6
localhost:~ okay$ cd Desktop/git/
localhost:git okay$ mkdir teslaRepo
localhost:git okay$ cd teslaRepo/
localhost:teslaRepo okay$ git init
Initialized empty Git repository in /Users/okay/Desktop/git/teslaRepo/.git/
localhost:teslaRepo okay$ git remote add origin tesla@123.57.159.74:/teslaRepo/teslaProject.git

上面的命令在本地創(chuàng)建了一個(gè)文件夾并添加了服務(wù)器上的遠(yuǎn)程倉庫

?
1
2
3
4
5
6
localhost:teslaRepo okay$ touch a.txt
localhost:teslaRepo okay$ git add a.txt
localhost:teslaRepo okay$ git commit -m "init commit"
[master (root-commit) d14cd3b] init commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a.txt

上面的命令在本地創(chuàng)建了一個(gè)a.txt并在本地提交了一次

?
1
2
3
4
5
6
7
localhost:teslaRepo okay$ git push origin master
tesla@123.57.159.74's password:
Counting objects: 3, done.
Writing objects: 100% (3/3), 202 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To tesla@123.57.159.74:/teslaRepo/teslaProject.git
 * [new branch]  master -> master

上面的命令將本地代碼push到遠(yuǎn)程服務(wù)器上去了,下面我們?cè)诒镜豤lone一次看下是否正確

七 本地clone

?
1
2
3
4
5
6
7
8
9
localhost:git okay$ mkdir ttt
localhost:git okay$ cd ttt
localhost:ttt okay$ git clone tesla@123.57.159.74:/teslaRepo/teslaProject.git
Cloning into 'teslaProject'...
tesla@123.57.159.74's password:
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.

clone完成,讓我們看一下文件夾目錄

在CentOS搭建Git服務(wù)器的詳細(xì)步驟

之前push到服務(wù)器上的a.txt文件已經(jīng)被clone下來

------------分割線-------------  

1. 查看系統(tǒng)用戶組

-d:指定字段的分隔符,默認(rèn)的字段分隔符為“TAB”;
-f:顯示指定字段的內(nèi)容;

?
1
cut -d: -f1 /etc/group

2. 查看系統(tǒng)用戶

?
1
cut -d: -f1 /etc/passwd

3. clone倉庫

?
1
git clone git@your_gitServer_ip:/home/gitrepo/sample.git

4. push已有倉庫

?
1
2
3
4
5
// 以master分支示范
git checkout master
git remote rm origin
git remote add origin git@your_gitServer_ip:/home/gitrepo/sample.git
git push -u origin master

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:http://www.jianshu.com/p/69ea5ded3ede

延伸 · 閱讀

精彩推薦
  • Centoscentos不小心刪除/root目錄該如何解決?

    centos不小心刪除/root目錄該如何解決?

    一些朋友最近在問小編centos不小心刪除/root目錄該如何解決?今天小編就為大家分享centos不小心刪除/root目錄解決辦法;希望對(duì)大家會(huì)有幫助,有需要的朋友...

    腳本之家8022019-05-29
  • CentosCentos 7開啟網(wǎng)卡自動(dòng)獲取IP的詳細(xì)方法

    Centos 7開啟網(wǎng)卡自動(dòng)獲取IP的詳細(xì)方法

    本篇文章主要介紹了Centos 7開啟網(wǎng)卡自動(dòng)獲取IP的詳細(xì)方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧...

    凌鋒8972021-12-29
  • CentosCentOS7設(shè)置日期和時(shí)間方法以及基本概念介紹

    CentOS7設(shè)置日期和時(shí)間方法以及基本概念介紹

    這篇文章主要介紹了CentOS7設(shè)置日期和時(shí)間方法以及基本概念介紹,本文講解使用CentOS7中的新命令timedatectl設(shè)置日期時(shí)間方法,需要的朋友可以參考下 ...

    CentOS之家6522019-09-19
  • Centoscentos 安裝與操作方法

    centos 安裝與操作方法

    這篇文章主要介紹了centos 安裝與操作方法,需要的朋友可以參考下...

    centos之家5272019-07-11
  • CentosCentOS下Uptime命令詳解

    CentOS下Uptime命令詳解

    在Linux下,我們可以使用uptime命令,而且此命令不必使用root權(quán)限。uptime命令在系統(tǒng)中已經(jīng)默認(rèn)安裝了。今天小編為大家?guī)淼氖荂entOS下Uptime命令詳解;希望...

    CentOS之家11482019-06-19
  • CentosCentOS 6.6實(shí)現(xiàn)永久修改DNS地址的方法

    CentOS 6.6實(shí)現(xiàn)永久修改DNS地址的方法

    這篇文章主要介紹了CentOS 6.6實(shí)現(xiàn)永久修改DNS地址的方法,涉及針對(duì)CentOS配置文件的相關(guān)設(shè)置技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下 ...

    Linux社區(qū)4472020-08-21
  • CentosCentos7運(yùn)用/dev/shm進(jìn)行網(wǎng)站優(yōu)化

    Centos7運(yùn)用/dev/shm進(jìn)行網(wǎng)站優(yōu)化

    這篇文章主要介紹了LINUX中Centos7運(yùn)用/dev/shm進(jìn)行網(wǎng)站優(yōu)化相關(guān)知識(shí)點(diǎn),對(duì)此有興趣的朋友參考學(xué)習(xí)下。...

    彬菌9912022-03-02
  • CentosCentOS6.5下Redis安裝與配置詳細(xì)步驟

    CentOS6.5下Redis安裝與配置詳細(xì)步驟

    本篇文章主要介紹了CentOS6.5下Redis安裝與配置詳細(xì)步驟,詳細(xì)介紹redis單機(jī)單實(shí)例安裝與配置,服務(wù)及開機(jī)自啟動(dòng)。有興趣的可以了解一下。...

    飛流11452021-12-24
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 一区二区在线 | 日本在线视频免费观看 | 日韩欧美一级片 | 久久精品成人 | 91国自产精品中文字幕亚洲 | 久久久久99精品 | 久操视频在线 | 国产成人综合av | 欧美日韩一区二区三区不卡视频 | 中文字幕一区二区三区在线视频 | 欧美精品一区二区三区手机在线 | 国产精品亚洲综合 | 欧美一区二区三区在线看 | 亚洲欧美日韩国产综合 | 久久综合久久久 | www国产在线观看 | 亚洲激情欧美 | 欧美成人精品激情在线观看 | 黄色影院 | 亚洲男人的天堂网站 | 精品欧美一区二区三区久久久 | 性农村人freesex | 国产精品久久久久久久久久妞妞 | 精品国偷自产国产一区 | 欧美视频在线播放 | 免费观看av大片 | 成人黄色av | 成人在线激情 | 精品欧美一区二区三区久久久 | 亚洲精品一区二区三区蜜桃久 | 精品少妇一区二区三区在线播放 | 亚洲精品在线看 | 色爱欧美| 亚洲一区中文字幕在线观看 | 一呦二呦三呦国产精品 | a视频在线观看 | 免费成人在线电影 | 免费黄色小视频 | 这里只有精品视频 | 国产一级毛片国语一级 | 亚洲 自拍 另类 欧美 丝袜 |