android 使用 git上传文件到github

While the EGit plugin for Eclipse is a good option, an even better one would be to learn to use git bash -- i.e., git from the command line. It isn't terribly difficult to learn the very basics of git, and it is often very benefitial to understand some basic operations before relying on a GUI to do it for you.

But to answer your question:

First things first, download git from http://git-scm.com/.

Then go to http://github.com/ and create an account and repository.

On your machine, first you will need to navigate to the project folder using git bash.

When you get there you do:


git init


which initiates a new git repository in that directory.

When you've done that, you need to register that new repo with a remote (where you'll upload -- push -- your files to), which in this case will be github. You'll get the correct URL from your repo on GitHub.


$ git remote add origin https://github.com/[username]/[reponame].git


You need to add you existing files to your local commit:


git add .   # this adds all the files


Then you need to make an initial commit, so you do:


git commit -a -m "Initial commit" # this stages your files locally for commit. 
                                  # they haven't actually been pushed yet


Now you've created a commit in your local repo, but not in the remote one. To put it on the remote, you do the second line you posted:


git push -u origin --all
转自

二:在已经创建了本地文件与github上的rep之间的联系后,提交代码的更新

1)git init

2) git status//检测文件改变状况

3)git add .//添加所有改变文件

3)git commit -m "这里添加提交的注释"

4)git push

这样就把本地项目修改的代码同步到github里的项目了


三:清除已经建立的本地文件与github链接, 来源

To remove a remote repository you enter:

git remote rm origin


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值