您的位置:首页 > 运维架构 > Linux

github for linux

2015-03-30 14:54 113 查看
github for linux (centos)

1,登陆https://github.com/注册账号

2,安装

# su root

#yum insatll git git-ui

把本地仓库传到github,需要配置ssh key

3,配置github

创建本地ssh key

#ssh-keygen -t rsa -C "你的邮箱"

#ls -a 列出隐藏文件

这时候会创建id_rsa id_rsa.pub两个文件

回到https://github.com/进入Accout Settings, 左边的列表中 选择ssh keys, add ssk key ,

然后 任意输入title, 将id_rsa.pub文件中的key ,粘贴到编辑框中。

4,测试能否连接

进入linux ,

#ssh -T git@github.com

You've successfully ,呵呵,就成功了。

遇到的问题,重新安装git git-ui

#yum reinstall git git-ui 重复上述过程问题解决了 .........

5,将本地仓库上传到github,要先设置username ,email(github将记录所有的commit)

6,设置git信息
# git config --global user.name "your name"
# git config --global user.email "your_email@youremail.com"

7,创建一个新的项目
#mkdir projectName 创建文件夹
#cd projectName 进入文件夹
#git init git初始化
#touch README 创建README文件
#git add README add README文
#git commit -m "commit file README" 提交

8, github端设置
在 github首页 Your Repositories处 点击“new repository” 输入名称和描述信息,选择private还是public 确定,新建一个repository(仓库)
复制ssh地址,

#git remote add origin 复制的地址 (https://github.com/xxxxx/xxxxx.git)

#git push -u origin master

error: The requested URL returned error: 403 Forbidden while accessinghttps://github.com/xxxxx/xxxxx.git/info/refs

fatal: HTTP request failed

解决办法:

#vim .git/config

url = https://github.com/yourname/example.git 修改成 url = https://yourname@github.com/yourname/example.git
就OK了

不错的博客:
http://www.cnblogs.com/purediy/archive/2013/03/07/2948892.html http://blog.csdn.net/showhilllee/article/details/27706679 http://blog.itpub.net/25851087/viewspace-1262468/
转自:http://blog.csdn.net/meiyoudao_jiushidao/article/details/44134819

不错的博客:
http://www.cnblogs.com/purediy/archive/2013/03/07/2948892.html http://blog.csdn.net/showhilllee/article/details/27706679 http://blog.itpub.net/25851087/viewspace-1262468/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: