git 使用

關於git的基本使用我就不表,若有不熟的推薦看OurUnixcsdn博客。因此這裏主要講下如何創建一個站在項目leader的角度,創建遠程倉庫。git

1創建你的git 目錄。ubuntu

ourunix@ubuntu :~$ mkdir testgitssh

ourunix@ubuntu :~$ cd testgit/測試

2,創建你的git倉庫。spa

ourunix@ubuntu :~/testgit$ git init.net

Initialized empty Git repository in /home/wlp/testgit/.git/unix

3,添加你的須要的項目初始文件,這裏我就只添加一張文檔了。orm

ourunix@ubuntu :~/testgit$ echo "hello,git" > sayhi.txtserver

4,跟蹤及提交到倉庫。blog

ourunix@ubuntu :~/testgit$ git add sayhi.txt

ourunix@ubuntu:~/testgit$ git commit -m "2011.4.13" sayhi.txt

[master (root-commit) b87b535] 2011.4.13

1 files changed, 1 insertions(+), 0 deletions(-)

create mode 100644 sayhi.txt

5.在本地的git倉庫"添加一個遠程倉庫",固然這個遠程倉庫仍是你本身的這個目錄。

ourunix@ubuntu:~/testgit$ git remote add origin ssh://你的IP/~/testgit/.git

這時候,本地的 .git/config 應該會改變

6.將本地的 master分支 ,跟蹤到遠程的分支

ourunix@ubuntu:~/testgit$ git push origin master

7,顯示遠程信息

ourunix@ubuntu:~/testgit$git remote show origin

8,利用其餘局域網的電腦測試你的倉庫

ourunix@ubuntu:~/test$ git clone ssh://你的IP/home//testgit/.git

Initialized empty Git repository in /home/wlp/test/git/.git/

xxx‘s password:

remote: Counting objects: 3, done.

Receiving objects: 100% (3/3), done.

remote: Total 3 (delta 0), reused 0 (delta 0)

9,大功告成,開始動手創建你的倉庫吧。


Ubuntu下 ssh : connect to host localhost port 22:Connection refused

Ubuntu下測試ssh時使用ssh localhost 命令,出現錯誤提示connect to host localhost port 22:Connection refused

 

形成這個錯誤的緣由多是ssh-server未安裝或者未啓動。ubuntu 11.10 默認安裝openssh-client,可是木有安裝server

 

運行 ps -e | grep ssh,查看是否有sshd進程

 

若是沒有,說明server沒啓動,經過 /etc/init.d/ssh -start 啓動server進程,若是提示ssh不存在 那麼就是沒安裝server

 

經過 sudo apt-get install openssh-server命令安裝便可



轉載記錄

相關文章
相關標籤/搜索