github上传资源操作思路

1、先在github网页上创建一个库,右上角点击“create a new repository”相关的键,

进入页面后会有让你填写相关的信息,其中的repository name就是你以后的包名。

“Initialize this repository with a README”这一行勾选上,会省去一步

操作,下面会讲。


2、下载github的客户端,地址http://windows.github.com/

3、安装完github会在桌面出现两个快捷键:GitHub和Git Shell,进入Git Shell

4、这一步要把第一步创建的库clone到本地,操作如下:

	ssh -T git@github.com(初始化版本之前先确认认证的公钥是否能用)

正确地结果如下: 

  Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
  Hi findingsea! You've successfully authenticated, but GitHub does not provide shell access.
warning不用理会。
	接着执行:
	git clone https://github.com/你在github的用户名/第一步创建的库名.git(比如我的是
https://github.com/updata7/protobuf_socket.git)

clone成功如下:

  Cloning into 'myRepoForBlog'...
  Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
  remote: Counting objects: 3, done.
  remote: Total 3 (delta 0), reused 0 (delta 0)
  Receiving objects: 100% (3/3), done.
5、这样,在github下多了一个目录,就是你在第一步创建的库名,用ls可看,进入这个目录,cd 库名
6、初始化git
   执行   git init
7、这一步如果在操作第一步时,有勾选“Initialize this repository with a README",可以忽略这一步。
否则,执行下面命令
    touch README.md
  git add README.md
  git commit -m 'first_commit'
  git remote add origin https://github.com/你在github的用户名/第一步创建的库名.git

  git push origin master
8、push(上传)文件,先把你要上传的文件全部拷贝到该目录下,再执行下面命令:
    git add .
  git commit -m 'first_commit'
  git remote add origin https://github.com/你在github的用户名/第一步创建的库名.git
  git push origin master     //上传文件
9、如果都没问题,就可以上github页面刷新,看看你已经上传的文件了。

第8步可能会遇到的问题:

如果执行git remote add origin https://github.com/你在github的用户名/第一步创建的库名.git ,出现错误:

  fatal: remote origin already exists

  则执行以下语句:

  git remote rm origin
如果还出现如下错误:
error: Could not remove config section 'remote.origin'
则需要在你的github安装目录下,找到gitconfig文件,删除
remote "origin"这一行。安装目录可以右键你桌面的Git Shell
查看。
否则
再执行git remote add origin https://github.com/你在github的用户名/第一步创建的库名.git 即可。

在执行git push origin master时,报错:

  error:failed to push som refs to.......

 

  则执行以下语句:

  git pull origin master

  先把远程服务器github上面的文件先拉来,再push 上去。



饮水思源:

http://www.cnblogs.com/findingsea/archive/2012/08/27/2654549.html
http://blog.csdn.net/dengjianqiang2011/article/details/9260435

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值