git使用

打开Git Bash

1、设置全局用户名和邮箱

$ git config --global user.name "Your Name" 
$ git config --global user.email "email@example.com"

2、设置公钥

2.1一般公钥存在 C:UsersAdministrator.ssh  先看看是否有此文件夹,进入此文件夹,删除里面的内容,命令:

cd ~/.ssh

rm id_rsa*

2.2生产新的密钥:(填写git.oschina.net 上注册的邮箱)

ssh-keygen -t rsa -C "xxxxx@qq.com" 

2.3然后回车几次就生成了密钥,打开 C:UsersAdministrator.ssh  文件夹看看

2.4查看密钥:

cat ~/.ssh/id_rsa.pub

2.5把密钥添加到 http://git.oschina.net/keys

2.6添加后,在终端(Terminal)中输入

ssh -T git@git.oschina.net
若返回
Welcome to Git@OSC, yourname! 

则证明添加成功。

将本地项目上传到git上: http://blog.csdn.net/g120406191/article/details/22525239

http://doc.cnpaas.io/git-osc/oschina-wordpress.html

原文地址:https://www.cnblogs.com/happyty/p/4919753.html