linux创建git远程仓库
root用户
============================
// 创建用户
>adduser newuser
// 修改用户的密码
>passwd newuser
// 设置权限
>chown 用户:用户组 -R folderName/
// 创建仓库(空白)
>git --bare init
// ssh连接
>git remote add origin ssh://你的用户名@你的IP/~/testgit/.git
来源: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
****************************************
修改用户的用户组
usermod -G groupname username
****************************************
chmod用来修改和创建用户,用户组,其他用户的权限
第一个数字代表用户具有的权限,第二个数字代表用户组的权限,第三个数组代表其他的权限
>chmod 7 -R someDir/
w: 4
r: 2
x: 1
7 = wrx
6 = wr-
5 = w-x
4 = w--
3 = -rx
2 = -r-
1 = --x
0 = ---
如果是文件的话,-R不需要
如果是文件夹的话,-R需要
linux创建git远程仓库的更多相关文章
- Linux下Git远程仓库的使用详解
Git远程仓库Github 提示:Github网站作为远程代码仓库时的操作和本地代码仓库一样的,只是仓库位置不同而已! 准备Git源代码仓库 https://github.com/ 准备经理的文件 D ...
- linux下git远程仓库的搭建
一.服务器环境 ubuntukylin-16.04-server-amd64 二.远程服务器创建一个名字叫git的用户,专门用于管理git仓库. $ adduser git 三.安装git.服务器端和 ...
- git远程仓库创建及权限管理(一)单个项目
最近接手公司git权限管理,既然负责此事个人觉得应该深入学习下,不仅为当前工作也为进一步发展.网上查找了一番,找到了完整的教程,所以这里不再一步一步描述,具体链接已给出,本文只对操作过程中遇到的问题的 ...
- git 远程仓库 轻松创建
很多时候,为了方面管理我们写的代码,我们采用git 远程仓库来进行管理和备份.防止代码被他人篡改或删除.那如何来进行创建远程仓库呢? 1.我们必须有一个远程服务器端,在这里可以把任意一台电脑作为服务器 ...
- 搭建git远程仓库
基于本地协议搭建git远程仓库 1.任意目录下执行git init -bare创建裸仓库,建议目录名称以.git结尾 2.共享此目录,windows下右键裸仓库目录,切换到共享面板设置完成即可获取共享 ...
- git jenkins 基本部署之git远程仓库
1.git远程仓库如何使用? 实战一.如何将本地仓库与远程Gitee进行关联? 1.注册gitee 2.创建一个远程仓库? 3.配置使用远程仓库 ...
- 创建Github远程仓库
如何创建github远程仓库 首先, 你有先到github网站注册账号https://github.com 然后创建一个项目, Create a new repository 之后在在Reposito ...
- GIT 远程仓库:添加远程库、从远程库克隆
到目前为止,我们已经掌握了如何在Git仓库里对一个文件进行时光穿梭,你再也不用担心文件备份或者丢失的问题了. 可是有用过集中式版本控制系统SVN的童鞋会站出来说,这些功能在SVN里早就有了,没看出Gi ...
- Git -- 远程仓库简介
到目前为止,我们已经掌握了如何在Git仓库里对一个文件进行时光穿梭,你再也不用担心文件备份或者丢失的问题了. 可是有用过集中式版本控制系统SVN的童鞋会站出来说,这些功能在SVN里早就有了,没看出Gi ...
随机推荐
- OpenvSwitch架构
Openvswitch的架构 数据库结构和OVS-VSCTL # ps aux | grep openvswitch root 1117 0.0 0.0 21200 1580 ? ...
- python学习笔记 - assert用法
[转自]http://blog.sina.com.cn/s/blog_76e94d210100vz37.html 1.assert语句用来声明某个条件是真的. 2.如果你非常确信某个你使用的列表中 ...
- c#实现数据的左补右补功能
/// <summary> /// 左補右補功能 /// </summary> /// <param name="st ...
- 310. Minimum Height Trees
For a undirected graph with tree characteristics, we can choose any node as the root. The result gra ...
- N Sum
题目:N Sum 描述: Given an array of integers, return indices of the two numbers such that they add up to ...
- hdu4642 Fliping game ——博弈
link:http://acm.hdu.edu.cn/showproblem.php?pid=4642 refer to: http://www.cnblogs.com/jackge/archive/ ...
- 第一课 T语言关键字(版本TC5.0)
关键字 TC综合开发工具的语法里包含了大量的关键字,而且对TC综合开发工具支持的关键字都做了亮色处理,以便大家在写脚本的时候容易区分. 关键字在使用的时候,都有特定的作用,不能作为变量名.函数名等等使 ...
- leetcode 104 Maximum Depth of Binary Tree ----- java
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...
- SVN代码提交冲突解决方案
SVN代码提交冲突解决方案 1.若你的代码被其他人修改并提交过了,期间你自己也修改过该文件,UPDATE的时候自己代码被覆盖. 右键——>显示日志 查看该文件的更新记录 找到需恢复的版本 右键— ...
- Android.mk 文件语法详解 转:http://blog.sina.com.cn/s/blog_602f8770010148ce.html
0. Android.mk简介: Android.mk文件用来告知NDK Build 系统关于Source的信息. Android.mk将是GNU Makefile的一部分,且将被Build Syst ...