linux git
来源:互联网 发布:mac桌面下方图标隐藏 编辑:程序博客网 时间:2024/05/16 23:47
三台机器,一台为192.168.37.129的 linux 服务器,两台台客户机 为 私人电脑 win7,都安装了windows的git, 客户机A 提交 客户机B 更新
Linux主机
创建git用户groupadd gituseradd -g git gitpasswd gitsu gitcd /home/gitmkdir .ssh
客户机A生成公钥(可以为windows):
ssh-keygen -t rsa -C "hyl@git.com"cd ~/.ssh/scp id_rsa.pub git@192.168.37.129:/home/git/.ssh/id_rsa.pub.hyl
Linux主机
设置 authorized_keyssu gitcd /home/gitmkdir .sshcat id_rsa.pub.hyl >> authorized_keyschmod 644 /home/git/.ssh/authorized_keyschmod 755 /home/git/.ssh一个原则,不能让除了git用户外的其他用户具有这两个文件和文件夹的write权限,否则无效。判断,在客户机A 用 git Bash 输入: ssh git@192.168.37.129如果出现: Enter passphrase for key '/c/Users/hanyuliang/.ssh/id_rsa': 表示要你输入生成公钥的私钥密码如果出现:git@192.168.37.129's password: 表示你加的公钥无效,去掉 authorized_keys 和 .ssh 其他用户的write权限
Linux主机 创建 GIT裸仓库
su gitcd ~mkdir project.gitcd project.git/git --bare initls 出现文件branches config description HEAD hooks info objects refs说明创建成功
客户机A 初始化仓库
创建 project 文件夹进入 右键 git bashgit inittouch READMEgit add READMEgit commit -m "init"git remote add origin git@192.168.37.129:/home/git/project.gitgit push origin master
客户机B 更新代码
进入任意文件件,不要是中文,右键 git bashgit clone git@192.168.37.129:/home/git/project.git进入project目录, 往README 写入 B modify!git add READMEgit commit -m "B modify"git push origin master
客户机A跟新 B修改的代码
git fetch origin
git merge origin master
0 0
- git linux
- Linux & Git
- linux git
- linux git
- linux git
- Linux git
- linux:git
- linux 安装git--fedora
- LINUX GIT 使用
- Installing on Linux GIT
- Linux git 安装
- Linux git(2)
- linux安装git
- linux下安装git
- Linux下使用git
- linux git工具使用
- Linux git入门教程
- linux git安装
- Android系统性能调优工具介绍
- poj 3276 Face The Right Way
- Perf -- Linux下的系统性能调优工具介绍
- 走迷宫(Dfs)
- iOS Runtime机制 - 类和对象(1)
- linux git
- Android补间动画属性
- Operating system error number 2 in a file operation
- c++之图的Dijkstra算法!
- 关于malloc函数死机的问题
- JSON使用简述
- linux scsi sd设备文件名的生成
- LeetCode - Word Break / Word Break II 题解
- hdu1503最长公共子序列加强版