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

如何在github上发布一个开源项目

2013-11-05 16:56 976 查看
参考网址:https://help.github.com/

1、在github上注册一个帐户,并登录

2、安装和配置git

sudo apt-get install git-core

git config --global user.name "Your Name Here"

git config --global user.email "your_email@example.com"   //这里的email地址应该与你登录github的email账户地址保持一致

git config --global credential.helper cache

git config --global credential.helper 'cache --timeout=3600'

3、Generating SSH Keys (https://help.github.com/articles/generating-ssh-keys)

ssh-keygen -t rsa -C "your_email@example.com"  //这里的email地址应该与你登录github的email账户地址保持一致

ssh-add ~/.ssh/id_rsa

成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的 key。

回到github,进入Account Settings,左边选择SSH Keys,Add SSH Key,title随便填,粘贴key

验证是否成功:

ssh -T git@github.com

4、在github上创建一个新的repository

5、初始化本地Repository

mkdir ~/YourRepositoryName

cd ~/YourRepositoryName

git init

touch README

git add README

git commit -m 'first commit'

6、将本地Repository连接到远程github上对应的Repository

git remote add origin https://github.com/yourName/YourRepositoryName.git
git push origin master

若出现:

error: The requested URL returned error: 403 while accessing https://github.com/yourName/YourRepositoryName.git/info/refs
fatal: HTTP request failed

git remote set-url origin ssh://git@github.com/yourName/YourRepositoryName.git

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