如何上传自己的库到github仓库上传文件夹

如何使用Git上传项目代码到github
githu是一个基于git的代码托管平台,付费用户可以建私人仓库,我们一般的免费用户只能使用公共仓库,也就是代码要公开。这对于一般人来说公共仓库就已经足够了。1.注册账户以及创建仓库要想使用githu第一步当然是注册githu账号了。之后就可以创建仓库了(免费用户只能建公共仓库),CeateaNewRepositoy,填好名称后Ceate,之后会出现一些仓库的配置信息,这也是一个git的简单教程。2.安装客户端totoiseGitgithu是服务端,要想在自己电脑上使用git我们还需要一个git客户端,我这里选用TotoiseGit,他给我们提供了图形界面的操作。在安装之前首先需要安装git,下载地址http:msysgit.githu.com,TotoiseGit下载地址:http:ptotoisegit装完后右键鼠标会多出一些选项来,在本地仓库里右键选择GitInitHee,会多出来一个.git文件夹,这就表示本地git创建成功。右键GitBash进入git命令行,为了把本地的仓库传到githu,还需要配置sshkey。3.配置Git(1)首先在本地创建sshkey;$ssh-keygen-tsa-C"you"后面的you改为你的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成功的话会在~下生成.ssh文件夹,进去,打开id_sa.pu,复制里面的key。回到githu,进入AccountSettings,左边选择SSHKeys,AddSSHKey,title随便填,粘贴key。
& 果果文库所有资源均来源于互联网,仅供网友学习交流,若侵犯了您的权益,请联系我们予以删除。
4980&&人浏览
11829&&人浏览
9166&&人浏览
16063&&人浏览
8803&&人浏览
18634&&人浏览
3685&&人浏览
12555&&人浏览
6659&&人浏览
18717&&人浏览
13473&&人浏览
5440&&人浏览
1091&&人浏览
5436&&人浏览
2821&&人浏览
本文标题:如何使用Git上传项目代码到github 链接地址:
2013- Inc. All Rights Reserved 果果文库 版权所有 联系站长: ; 经营许可证编号:浙ICP备号创建新的git仓库
设置新仓库
创建完成后
复制git地址
现在已经有window git客户端了(地址:),但还是建议用git命令行(客户端下载完成后会有相关的步骤介绍非命令行模式的快速指导)
下载页面中的这个按钮则可以下载
下面是命令行模式 安装好git客户端后,可以设置
设置默认终端为git bash,你也可以不设置,看个人喜好,安装好之后不设置的话我的win10是powershell
然后打开 git shell
然后就是到你想要的目录
下图切换到自己设置的目录中,然后就是克隆刚才开始时候在github上新建的目录
然后就可以继续了,把你想要上传的东西复制到你相应的本地git文件夹,如下,我的readme文件也都修改了一下
然后回到终端,执行如下命令就可以把文件上传上去了
上传成功后
如果需要将新的分支的内容合并到master分支上可以执行下面的语句
然后这样子master也就有了
删除一个git仓库(自己的)
拉到页面最后
删除后不能回滚,这里输入的是要确认删除的仓库名
阅读(...) 评论()上传项目到GitHub,同步远程Github仓库_Linux教程_Linux公社-Linux系统门户网站
你好,游客
上传项目到GitHub,同步远程Github仓库
来源:Linux社区&
作者:Linux
最近在写一个简单的项目,不过由于人员管理上松散,所以决定把代码提交至GitHub,提前感受一下一直很火的GitHub。
历程简述:
1、本来想偷懒,看看有没有类似subversion,简单操作的团队开源工具,不过之前是在javaweb方向上使用,在移动开发上当然用适合的工具了,于是舍弃之
2、再一想,有莫有eclipse的插件,集成上传,下载github上的源码呢?参考(使用GitHub管理Eclipse分布式项目开发 ),但是说的不是很详细,因为我的eclipse是最新google公司的版本,安上插件会报错,而且启动界面也会有变化,捣鼓了2个小时,但是仍然没有头绪,又舍弃之。
3、最后,我安定思痛,想想我想要的流程是什么?
上传本地代码-&github网站
团队其他人从上面拷贝下来
改完之后再提交上去
于是google之,
再参考下面这几篇文章:
在GitHub上分享和展示你的代码&
Git/Github使用方法笔记
下面的代码是记录记录而已,有兴趣的可以看一下,时间比较仓促,还望多多够沟通,一起在github上关注、学习大牛们!
Welcome to Git (version 1.8.3-preview)
Run 'git help git' to display the help index.Run 'git help &command&' to display help for specific commands.
Administrator@VAIO- /d/GitHub/RescueApp$ git config --global user.name "jptiancai"
Administrator@VAIO- /d/GitHub/RescueApp$ git config --global user.email mail_
Administrator@VAIO- /d/GitHub/RescueApp$ ssh-keygen -C 'mail_' -t rsa
Administrator@VAIO- /d/GitHub/RescueApp$ ssh-keygen -C 'mail_' -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/c/Documents and Settings/Administrator/.ssh/id_rsa):/c/Documents and Settings/Administrator/.ssh/id_rsa already exists.Overwrite (y/n)? yEnter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /c/Documents and Settings/Administrator/.ssh/id_rsa.Your public key has been saved in /c/Documents and Settings/Administrator/.ssh/id_rsa.pub.The key fingerprint is:9f:be:0c:2e:de:a5:5f:2b:86:3e:73:1d:33:71:60:ab mail_
Administrator@VAIO- /d/GitHub/RescueApp$ git initInitialized empty Git repository in D:/GitHub/RescueApp/.git/
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git add .warning: LF will be replaced by CRLF in AndroidManifest.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in gen/com/yonvoo/main/BuildConfig.java.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in proguard-project.txt.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in project.properties.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values-v11/styles.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values-v14/styles.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values/strings.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values/styles.xml.The file will have its original line endings in your working directory.
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git remote add origin :jptiancai/RescueApp.git
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git push origin masterfatal: Could not read from remote repository.
Please make sure you have the correct access rightsand the repository exists.
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git push origin masterThe authenticity of host ' (204.232.175.90)' can't be established.RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.Are you sure you want to continue connecting (yes/no)? yPlease type 'yes' or 'no': yesWarning: Permanently added ',204.232.175.90' (RSA) to the list of known hosts.error: src refspec master does not match any.error: failed to push some refs to ':jptiancai/RescueApp.git'
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git push origin mastererror: src refspec master does not match any.error: failed to push some refs to ':jptiancai/RescueApp.git'
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git commit -m 'initial commit'[master (root-commit) 926da3f] initial commitwarning: LF will be replaced by CRLF in AndroidManifest.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in gen/com/yonvoo/main/BuildConfig.java.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in proguard-project.txt.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in project.properties.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values-v11/styles.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values-v14/styles.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values/strings.xml.The file will have its original line endings in your working directory.warning: LF will be replaced by CRLF in res/values/styles.xml.The file will have its original line endings in your working directory.&74 files changed, 1548 insertions(+)&create mode 100644 .gitattributes&create mode 100644 .gitignore&create mode 100644 AndroidManifest.xml&create mode 100644 gen/com/yonvoo/main/BuildConfig.java&create mode 100644 gen/com/yonvoo/main/R.java&create mode 100644 ic_launcher-web.png&create mode 100644 libs/android-support-v4.jar&create mode 100644 proguard-project.txt&create mode 100644 project.properties&create mode 100644 res/drawable-hdpi/app_logo.png&create mode 100644 res/drawable-hdpi/bg.png&create mode 100644 res/drawable-hdpi/butten_pressed.png&create mode 100644 res/drawable-hdpi/dark_dot.png&create mode 100644 res/drawable-hdpi/guide_350_01.jpg&create mode 100644 res/drawable-hdpi/guide_350_02.jpg&create mode 100644 res/drawable-hdpi/guide_350_03.jpg&create mode 100644 res/drawable-hdpi/guide_350_04.jpg&create mode 100644 res/drawable-hdpi/ic_launcher.png&create mode 100644 res/drawable-hdpi/item_bg.png&create mode 100644 res/drawable-hdpi/photo8.png&create mode 100644 res/drawable-hdpi/richangyiwai.png&create mode 100644 res/drawable-hdpi/settings.png&create mode 100644 res/drawable-hdpi/welcome.png&create mode 100644 res/drawable-hdpi/welcome_android.jpg&create mode 100644 res/drawable-hdpi/white_dot.png&create mode 100644 res/drawable-hdpi/yundongzijiu.png&create mode 100644 res/drawable-hdpi/ziranzaihai.png&create mode 100644 res/drawable-ldpi/butten_pressed.png&create mode 100644 res/drawable-ldpi/butten_unpress.png&create mode 100644 res/drawable-ldpi/dark_dot.png&create mode 100644 res/drawable-ldpi/guide_350_01.jpg&create mode 100644 res/drawable-ldpi/guide_350_02.jpg&create mode 100644 res/drawable-ldpi/guide_350_03.jpg&create mode 100644 res/drawable-ldpi/guide_350_04.jpg&create mode 100644 res/drawable-ldpi/ic_launcher.png&create mode 100644 res/drawable-ldpi/logo.png&create mode 100644 res/drawable-ldpi/welcome_android.jpg&create mode 100644 res/drawable-ldpi/white_dot.png&create mode 100644 res/drawable-mdpi/ic_launcher.png&create mode 100644 res/drawable-xhdpi/ic_launcher.png&create mode 100644 res/drawable/dot.xml&create mode 100644 res/drawable/whats_new_start_btn.xml&create mode 100644 res/layout/detail.xml&create mode 100644 res/layout/griditem.xml&create mode 100644 res/layout/guide.xml&create mode 100644 res/layout/listview_item.xml&create mode 100644 res/layout/main.xml&create mode 100644 res/layout/splash.xml&create mode 100644 res/layout/test.xml&create mode 100644 res/layout/what_new_four.xml&create mode 100644 res/layout/what_new_one.xml&create mode 100644 res/layout/what_new_three.xml&create mode 100644 res/layout/what_new_two.xml&create mode 100644 res/menu/activity_main.xml&create mode 100644 res/values-v11/styles.xml&create mode 100644 res/values-v14/styles.xml&create mode 100644 res/values/strings.xml&create mode 100644 res/values/styles.xml&create mode 100644 src/com/yonvoo/activity/DetailActivity.java&create mode 100644 src/com/yonvoo/activity/GuideActivity.java&create mode 100644 src/com/yonvoo/activity/MainActivity.java&create mode 100644 src/com/yonvoo/activity/SecCategoryActivity.java&create mode 100644 src/com/yonvoo/activity/SplashActivity.java&create mode 100644 src/com/yonvoo/adapter/GridViewAdapter.java&create mode 100644 src/com/yonvoo/adapter/ListViewAdapter.java&create mode 100644 src/com/yonvoo/adapter/ViewPagerAdapter.java&create mode 100644 src/com/yonvoo/domain/Category.java&create mode 100644 src/com/yonvoo/domain/Detail.java&create mode 100644 src/com/yonvoo/domain/SecCategory.java&create mode 100644 src/com/yonvoo/service/CategoryService.java&create mode 100644 src/com/yonvoo/service/DBHelper.java&create mode 100644 src/com/yonvoo/service/DetailService.java&create mode 100644 src/com/yonvoo/service/SecCategoryService.java&create mode 100644 src/com/yonvoo/test/DBTest.java
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git push origin masterTo :jptiancai/RescueApp.git&! [rejected]& & & & master -& master (fetch first)error: failed to push some refs to ':jptiancai/RescueApp.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first merge the remote changes (e.g.,hint: 'git pull') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Administrator@VAIO- /d/GitHub/RescueApp (master)$ git push -fwarning: push. its implicit value is changing inGit 2.0 from 'matching' to 'simple'. To squelch this messageand maintain the current behavior after the default changes, use:
& git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
& git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode'current' instead of 'simple' if you sometimes use older versions of Git)
Counting objects: 92, done.Delta compression using up to 4 threads.Compressing objects: 100% (81/81), done.Writing objects: 100% (92/92), 2.20 MiB | 966.00 KiB/s, done.Total 92 (delta 12), reused 0 (delta 0)To :jptiancai/RescueApp.git&+ be58463...926da3f master -& master (forced update)
Administrator@VAIO- /d/GitHub/RescueApp (master)$
---------------------------------------------------后续更新--------------------------------------------------
时隔多日,再次用到git这个神级的版本管理工具的时候,上面的代码依然有用,在这里稍微总结一下,方便以后查看:
创建个人项目到github上或者fork别人的项目
配置用户名、密码、私钥---&和github取得连接,如需要设置代理上网,请看这篇:在公司的局域网使用git或github 设置代理[1]
添加本地文件到github代码库中---& inti,add,remote add, commit,push,遇到master整合到master的时候,可以用 -f,强制merge
git clone github地址,可参照下图直接复制粘贴。
GitHub Guides[2]:目前教学文章较少,仅仅9篇,但是篇篇都很经典,从HelloWorld开始看,你一定会有收获。
Git官网[3]:网站十分友好,提供了在线TryGit学习方式,文档,视频,软件,一应俱全。
Git cheatsheet[4]:里面有大部分的命令,很实用!
提交你自己的代码,参考Pushing to a remote[1]
fork你喜欢的库
git branch new_branchgit checkout new_branch一系列操作(git add......)git push origin new_branch
----------------&
之后刷新官网会有所显示,提交上去,等待使用者审核通过
提交自己的代码,同步最新的代码,参考[2],[3]
merge到自己项目的master上,提交后就看原作者的审核了&git checkout master---&以master的身份运行&git merge new_branch&git diff new_branch master&git status
情景:已经从原始项目(orgin)在页面上fork一个自己的项目主页(master),本地上也有一个工作版本(local,虽然在控制台上看到的是master,但是应该这样理解).最近看到origin项目更新的好多东西,首先是更新&
git fetch xx(origin项目的git地址,这个可以在页面copy):bash返回信息 &* branch &HEAD &-& FETCH_HEAD
git merge HEAD FETCH_HEAD:按照提示,本地仓库(local)和原始项目(origin)同步信息
git push:本地项目(local)提交到自己的项目主页(master).
参考文章:
GitHub 教程系列文章:&
通过GitHub创建个人技术博客图文详解&
GitHub 使用教程图文详解& &
Git 标签管理详解 &
Git 分支管理详解 &
Git 远程仓库详解 &
Git 本地仓库(Repository)详解 &
Git 服务器搭建与客户端安装& &
Git 概述 &
分享实用的GitHub 使用教程 &
GitHub 的详细介绍: GitHub 的下载地址:
&本文永久更新链接地址:
相关资讯 & & &
& (06月27日)
& (06月05日)
& (07月09日)
& (06月13日)
& (05月22日)
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款如何使用Git上传项目代码到github
&这是我第一次应用git,以下仅供git的初学者参考。
github是一个基于git的代码托管平台,付费用户可以建私人仓库,我们一般的免费用户只能使用公共仓库,也就是代码要公开。这对于一般人来说公共仓库就已经足够了。
1.注册账户以及创建仓库
要想使用github第一步当然是注册github账号了。之后就可以创建仓库了(免费用户只能建公共仓库),Create a New
Repository,填好名称后Create,之后会出现一些仓库的配置信息,这也是一个git的简单教程。
2.安装客户端tortoiseGit
github是服务端,要想在自己电脑上使用git我们还需要一个git客户端,我这里选用TortoiseGit,他给我们提供了图形界面的操作。在安装之前首先需要安装git,下载地址,TortoiseGit下载地址:
装完后右键鼠标会多出一些选项来,在本地仓库里右键选择Git Init
Here,会多出来一个.git文件夹,这就表示本地git创建成功。右键Git
Bash进入git命令行,为了把本地的仓库传到github,还需要配置ssh key。
(1) 首先在本地创建ssh key;
&&& $ ssh-keygen
-t rsa -C ""
&后面的改为你的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的key。回到github,进入Account
Settings,左边选择SSH Keys,Add SSH Key,title随便填,粘贴key。
&(2)为了验证是否成功,在git
bash下输入:
&&& $ ssh -T
&如果是第一次的会提示是否continue,输入yes就会看到:You’ve
successfully authenticated, but GitHub does not provide shell
access 。这就表示已成功连上github。
&(3)接下来我们要做的就是把本地仓库传到github上去,在此之前还需要设置username和email,因为github每次commit都会记录他们。
&$ git config --global user.name "your name"
&$ git config --global user.name "your name"$ git
config --global user.email ""
&(4)进入要上传的仓库,右键git bash,添加远程地址:
&&$ git remote add origin
&后面的yourName和yourRepo表示你再github的用户名和刚才新建的仓库,加完之后进入.git,打开config,这里会多出一个remote
“origin”内容,这就是刚才添加的远程地址,也可以直接修改config来配置远程地址。
4.提交、上传
&&(1)接下来在本地仓库里添加一些文件,比如README,
&& $ git add README
&& $ git add README$ git commit
-m "first commit"
&& (2)上传到github:
&& $ git push origin master
push命令会将本地仓库推送到远程服务器。
&& git pull命令则相反。
&& 修改完代码后,使用git
status可以查看文件的差别,使用git add 添加要commit的文件,也可以用git add -i来智能添加文件。之后git
commit提交本次修改,git push上传到github。
& 5.gitignore文件
&.gitignore顾名思义就是告诉git需要忽略的文件,这是一个很重要并且很实用的文件。一般我们写完代码后会执行编译、调试等操作,这期间会产生很多中间文件和可执行文件,这些都不是代码文件,是不需要git来管理的。我们在git
status的时候会看到很多这样的文件,如果用git add
-A来添加的话会把他们都加进去,而手动一个个添加的话也太麻烦了。这时我们就需要.gitignore了。比如一般c#的项目我的.gitignore是这样写的:
bin和obj是编译目录,里面都不是源代码,忽略;suo文件是vs2010的配置文件,不需要。这样你在git
status的时候就只会看到源代码文件了,就可以放心的git add -A了。
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。如何上传本地代码到github上 - 简书
如何上传本地代码到github上
第一步:建立git仓库cd到你的本地项目根目录下,执行git命令,此命令会在当前目录下创建一个.git文件夹。git init第二步:将项目的所有文件添加到仓库中git add .这个命令会把当前路径下的所有文件,添加到待上传的文件列表中。如果想添加某个特定的文件,只需把.换成特定的文件名即可第三步:将add的文件commit到仓库git commit -m "注释语句"第四步:去github上创建自己的Repository,点击NewRepository
如下图所示:
点击Create repository,就会进入到类似下面的一个页面,拿到创建的仓库的https地址第五步:将本地的仓库关联到github上git remote add origin https://自己的仓库url地址第六步,上传代码到github远程仓库git push -u origin master执行完后,如果没有异常,等待执行完就上传成功了,中间可能会让你输入Username和Password,你只要输入github的账号和密码就行了.}

我要回帖

更多关于 github上传数据库 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信