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

github 在ubuntu上使用入门

2015-05-28 15:08 387 查看
首先注册一个github帐号,然后create a new repository,随便娶个名字.,如customtitlebar.

然后在ubuntu终端下安装git:

sudo apt-get install git

然后git初始设置:

git config --global user.name "pythonsoft" #你的github用户名

git config --global user.email pythonisfun@gmail.com #你注册github所使用的邮箱

然后初始化git仓库:

cd /workspace #切换到你的工作目录,随意

git init

git add project #添加你想要上传的工程或文件到git 仓库

添加必要的说明文件README.md,介绍你的工程:

echo "#custom title bar" >> README.md

git add README.md

然后提交

git commit -m "简要说明:比如修改了什么bug"

然后上传仓库:

git remote add origin https://github.com/pythonsoft/customtitlebar.git #上传的url路径,后面跟的是 用户名/repository.git

git push -u origin master

根据提示输入用户名,密码,等一会儿就上传成功。打开你的github,你会看到文件已经上传了.

如果你使用了代理,可能会遇到下面的错误:

steven@steven-OptiPlex-330:/$ git push -u origin master
error: The requested URL returned error: 407 while accessing https://github.com/pythonsoft/customtitlebar.git/info/refs fatal: HTTP request failed
steven@steven-OptiPlex-330:/$ sudo gedit .git/config
编辑 .git/config文件添加代理:

[http]
proxy = http://user:pass@ip_or_host:port [https]
proxy = http://user:pass@ip_or_host:port[/code] 保存后,重新执行

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