首先, 如果你的ssh没有安装的话,要安装ssh服务端。ubuntu是很简单

  1. 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

使用git建立远程仓库,让别人git clone下来的更多相关文章

  1. git初次建立远程仓库问题

    git "Could not read from remote repository.Please make sure you have the correct access rights. ...

  2. 【Eclipse中使用Git之一】把远程仓库的项目,clone到eclipse里面

    [Eclipse中使用Git之一]把远程仓库的项目,clone到eclipse里面 2015-01-29 19:25 15779人阅读 评论(1) 收藏 举报 .embody{ padding:10p ...

  3. windows下使用git和github建立远程仓库

    转自(http://www.bubuko.com/infodetail-430228.html) 从昨天开始就在看git的使用,因为在Windows下很多命令行操作都比较坑爹,但是今天再走了无数弯路之 ...

  4. 四、 git关联远程仓库及推送

    接之前笔记,在 github上建立与本地同名的仓库 demo 关联远程仓库 1. https 模式     远程库的名字就是origin,这是Git默认的叫法 git remote add origi ...

  5. git学习——远程仓库操作

    查看当前的远程库——git remote 列出了仅仅是远程库的简单名字 可以加上-v 现实对应的克隆地址 添加远程仓库——git remote add [shortname] [url] git re ...

  6. [转]git修改远程仓库地址

    原文链接:http://www.cnblogs.com/lazb/articles/5597878.html 问:Coding远程仓库地址变了,本地git仓库地址如何更新为最新地址 git修改远程仓库 ...

  7. 为git创建远程仓库

    首先生成ssh公钥: 将公钥添加到git: 测试秘钥是否通过: 然后就可以到web界面看到标注的地方被绿了: 但是我的没有绿,不知道为啥,难道没有女朋友的原因吗? rm -rf .ssh 重来好几遍都 ...

  8. git从远程仓库拉取内容或向远程仓库上传内容

    一.将本地文件上传到远程仓库步骤 git init git add . git commit -m "初始框架" git remote add origin https://git ...

  9. Git应用详解第五讲:远程仓库Github与Git图形化界面

    前言 前情提要:Git应用详解第四讲:版本回退的三种方式与stash 这一节将会介绍本地仓库与远程仓库的一些简单互动以及几款常用的Git图形化界面,让你更加方便地使用git. 一.Git裸库 简单来说 ...

随机推荐

  1. WPF中ComboBox绑定数据库自动读取产生数据

    前台端 <ComboBox HorizontalAlignment="Name="cmb_SSBM" DisplayMemberPath="NAME&qu ...

  2. 理解insert all/insert first的使用

    在常用的SQL写法中我们会经常遇到把一个表的数据插入另外一张表的情况,这是一个insert into 表名 select .... from 表名   就可以解决了.但是如果是把一张表的数据同时插入两 ...

  3. [NoSQL]验证redis的主从复制

    安装配置redis  http://www.cnblogs.com/myrunning/p/4222385.html 1.1查看当前redis文件 1.2修改配置文件 拷贝配置文件分别为redis_m ...

  4. SQL Server 2008 下载及安装教程

    sql server 2008 是微软公司开发的一套数据库管理系统.是目前大型数据库中常用数据库之一.性能稳定,功能强大,是面向中大型企业的一款数据库解决方案.我们安装SqlServer2008的时候 ...

  5. github标记

    <template> <a href="https://github.com/lmk123/Runner" class="github-corner&q ...

  6. java中hashCode方法与equals方法的用法总结

    首先,想要明白hashCode的作用,必须要先知道Java中的集合. 总的来说,Java中的集合(Collection)有两类,一类是List,再有一类是Set. 前者集合内的元素是有序的,元素可以重 ...

  7. JS-页面操作

    --刷新页面 window.location.reload();

  8. 【翻译】How To Tango With Django 1.5.4 第二章

    2.开始吧! 准备好两个关键的安装包 Python version 2.7.5 Django version 1.5.4 2.1熟悉你自己的系统(我的是windows) 略 2.2安装软件 2.2.1 ...

  9. Mac更换Sublime Text程序图标

    更换方法: 下载.icns格式一个图标.http://www.easyicon.net/language.en/iconsearch/sublime/ 终端执行:open /Applications/ ...

  10. MVC 使用entity framework 访问数据库 发布IIS

    1.  SQL SERVER 数据库内容 2. MVC工程 3. EF 参考 工程架构: 对应实体类: public class MvcUser { public int Id { get; set; ...