歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Ubuntu配置git服務操作

Ubuntu配置git服務操作

日期:2017/3/1 16:56:18   编辑:關於Linux
Ubuntu配置git服務操作 1、准備相關軟件 1.1 准備ssh必要工具   方便登錄和進行ssh認證: www.2cto.com 1 $ sudo apt-get install openssh-client 2 $ sudo apt-get install openssh-server 1.2 准備必要的git工具   注意建立專用用戶進行控制,比如後面的兩條命令: 1 $ sudo apt-get install git git-core 2 $ sudo useradd git 3 $ sudo passwd git www.2cto.com 2、 創建服務器端的空白倉庫 1 $ mkdir -p gitRepo/project.git #創建必要項目文件夾 2 $ git --bare init gitRepo/project.git # 初始化空白倉庫 3、 客戶端初始化倉庫和提交代碼 $ cd project $ git init $ git add . $ git commit -am "init the repo" $ git remote add origin user@ip:/path/to/project.git #設置遠程倉庫路徑 $ git push origin master #提交第一版代碼了; 注意:如果設置的遠程庫路徑有問題,可以通過git config 命令來修正,比如: 1 $ git config remote.origin.url #查看當前設置的路徑 2 $ git config remote.origin.url user@ip:/path/to/project.git #修改當前路徑為後者 4、 開始協作   其他用戶可以通過直接git clone的方式進行合作了,比如: $ git clone user@ip:/path/to/project.git local_project_name 來源 http://www.cnblogs.com/QuLory/archive/2013/01/21/2869108.html
Copyright © Linux教程網 All Rights Reserved