Git 杂记

1. Windows端Git配置

  1. 安装git bash

  2. 配置ssh和密钥

// cd ~ 进入用户Home目录下
$ ssh-keygen 回车,一直回车,直到生成图形(randomart image) 
$ cd ~/.ssh   
$ vi config  编辑生成一个config文件  内容如下:   
   
user leilll 
port 29888 // 端口
host 192.168.10.88  // ip地址
identityfile ~/.ssh/id_rsa     wq  保存退出 
  1. 将id_rsa.pub里的内容拷贝到gerrit上,具体如下
打开192.168.10.88 gerrit网页, 
点击setting --> ssh public key --> add 添加进去 
最后用ssh 192.168.10.88连接是否成功。 
  1. 将公钥(id_rsa.pub中的内容)添加到 gerrit代码服务器上

  2. 拉取代码

$ git clone ssh

2. Create a new repository on the command line

$ echo "# Anti-sCustom" >> README.md 
$ git init 
$ git add README.md 
$ git commit -m "first commit" 
$ git remote add origin  
$ git push -u origin master 

3. Push an existing repository from the command line

$ git remote add origin  
$ git push -u origin master

你可能感兴趣的:(Git 杂记)