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

github安装过程及初次上传遇到的问题

2014-03-19 09:13 204 查看
一:github安装过程

1.登陆github,注册及创建一个仓库。

2.在本地下载安装客户端msysgit。 网址:https://code.google.com/p/msysgit/downloads/list。

3.配置git.

设置sshkey: $ssh-keygen -C 'email address' -t rsa,一直next,最后在.ssh文件夹中找到id.rsa.pub文件。复制里面的密钥到github项目—>accout settings,找到SSH Keys,new a ssh key. 复制本地 id.rsa.pub文件的密钥到new key的的Key中。添加完成后,可在git shell中验证,$ ssh -T git@github.com,会提示success.

4. 输入git config --global user.name "注册的name"

5.输入git config --global user.email "注册的email"

6.在本地创建一个仓库,选择磁盘,创建文件夹test(文件夹名与网站上的仓库名相同),

7.进入该文件夹,初始化仓库: git init

8.将要上传的代码的文件夹(如:code)放到test里。用git add .可将code文件夹的所有内容添加到仓库上传队列中。另用git add 文件名,可将某个文件内容添加到仓库中。

9.输入git commit -m 'test commit'

10.输入git remote add origin https://github.com/用户名/仓库名.git
11.输入git push origin master。如果提交报错:error: failed to push some refs to 'https://github.com/xuzhezhaozhao/Practice.git' 。用参数-f(force-push),输入git push -f origin master即可上传成功。

参见:http://www.woiweb.net/github-gitshell-tutorial.html
http://blog.csdn.net/xzz_hust/article/details/8916668 http://note.youdao.com/share/?id=f320b42c886a907ad03b7349ae1ab26c&type=note

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