您的位置:首页 > 编程语言

ubuntu-14.04下安装git并连接github的设置方法

2016-01-21 14:47 411 查看

1. git的安装

sudo apt-get install git
sudo apt-get install openssh-server
sudo apt-get install openssh-client
sudo apt-get install git-gui
sudo apt-get install git-doc

git config --global user.name "mogran"
git config --global user.email "mingllu@163.com"


2.生成密钥

ssh-keygen -C 'mingllu@163.com' -t rsa


3.注册github

注册就不说了,有一点,国内的邮箱,比如163,qq,1之类的是不能注册成功的,要用gamil邮箱注册才行,github注册地址点这里 www.github.com

4.在github的个人账号中添加密钥

find your profile
click on ssh
add ssh
然后把刚生成的密钥就是 ~/.ssh/id_rsa.pub中的文件数据拷贝放到github的ssh中去


5.测试git连接github.com

ssh -T git@github.com


6.托管本地的项目代码到github上

首先在github上new一个仓库

然后在本地clone这个仓库

接着在本地clone下的文件夹中使用如下命令

git init
git add .   //.表示该文件下所有的文件
git commit -m "提交信息"
git push origin master


7.结束

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: