使用git建立远程仓库,让别人git clone下来
2014-05-27 21:54
411 查看
摘自:http://blog.chinaunix.net/uid-22028680-id-3040436.html
首先, 如果你的ssh没有安装的话,要安装ssh服务端。ubuntu是很简单
sudo apt-get install openssh-server
1,建立你的git 目录。
ourunix@ubuntu:~$ mkdir testgit
ourunix@ubuntu:~$ cd testgit/
2,建立你的git仓库。
ourunix@ubuntu:~/testgit$ git init
Initialized empty Git repository in /home/wlp/testgit/.git/
3,添加你的需要的项目初始文件,这里我就只添加一张文档了。
ourunix@ubuntu:~/testgit$ echo "hello,git" > sayhi.txt
4,跟踪及提交到仓库。
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,大功告成
10. 修改远程分支地址
git remote set-url origin remote_git_address
NOSQL
Ubuntu下测试ssh时使用ssh localhost 命令,出现错误提示connect to host localhostport 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命令安装即可
首先, 如果你的ssh没有安装的话,要安装ssh服务端。ubuntu是很简单
sudo apt-get install openssh-server
1,建立你的git 目录。
ourunix@ubuntu:~$ mkdir testgit
ourunix@ubuntu:~$ cd testgit/
2,建立你的git仓库。
ourunix@ubuntu:~/testgit$ git init
Initialized empty Git repository in /home/wlp/testgit/.git/
3,添加你的需要的项目初始文件,这里我就只添加一张文档了。
ourunix@ubuntu:~/testgit$ echo "hello,git" > sayhi.txt
4,跟踪及提交到仓库。
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,大功告成
10. 修改远程分支地址
git remote set-url origin remote_git_address
Ubuntu下 ssh :connect to host localhost port 22:Connection refused
博客分类:NOSQL
Ubuntu下测试ssh时使用ssh localhost 命令,出现错误提示connect to host localhostport 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命令安装即可
相关文章推荐
- 使用git建立远程仓库,让别人git clone下来
- 使用git建立远程仓库,让别人git clone下来
- 使用git建立远程仓库,让别人git clone下来
- 使用git建立远程仓库,让别人git clone下来
- 使用git建立远程仓库,让别人git clone下来
- 使用git建立远程仓库,让别人git clone 下来
- 使用git建立远程仓库,让别人git clone下来
- 使用git建立远程仓库,让别人git clone下来
- 使用git建立远程仓库,让别人git clone下来
- git建立远程仓库,让别人git clone下来(leader 角度)
- windows下使用git和github建立远程仓库
- windows下使用git和github建立远程仓库
- eclipse如何使用git从远程仓库clone项目?
- windows下使用git和github建立远程仓库
- Git使用手册/Git教程:git clone 克隆下载远程仓库项目工程到本地工作区
- git使用(2) --在github上建立远程仓库
- windows下使用git和github建立远程仓库
- git 不用clone整个远程仓库,只把特定的commit给fetch下来的方案
- 【Eclipse中使用Git之一】把远程仓库的项目,clone到eclipse里面
- Github:在eclipse中使用git clone 别人共享在Github的代码和上传到自己的仓库!