Linux 上安装git仓库
1. 安装git
sudo apt-get install git
2. 配置用户名和邮件
git config --global user.name "ew"
git config --global user.email "ew"
3. 创建一个项目仓库
pwd : /home/ew/java/git_repository
sudo mkdir repo.git
cd repo.git/
git init : Initialized empty Git repository in /home/ew/java/git_repository/repo.git/.git/
Windows 上通过ssh去clone项目
1.git clone ssh://ew@192.168.3.226/home/ew/java/git_repository/repo.git
或
git clone ew@192.168.3.226:/home/ew/java/git_repository/repo.git
2.如果Windows上没有配置密钥和公钥,此时需要输入ew@192.168.3.226的密码,如果配置了公钥,就输入公钥的密码或不输入密码(生成公钥没有加密码)
3. 向仓库中增加内容
git add file
4. 提交
git commit -m "commit message"
5. push (git仓库需要文件读写权限)
git push
一、生成密钥和公钥
Git Bash
ssh-keygen -t rsa -C "s@s.com"