Tuesday, May 5, 2015

how to publish local folder to github 如何把电脑硬盘里的文件上传到github.com

how to publish folder to github


1) add  -> browse to folder --> create a repository


2) write the name  --> create repository

3) publish repository --> write a name


4) uncommit change --> write something --> commit to master



5) click unsynced change  "sync + 1"  

6) You should have it upload to github




How to use git bash command line?

1) use cd /c/jh/backup to go the folder you want to upload. (先进入到要上传的地方)

2) git init ( 把要上传的文件夹先变成git repository )

3)  git add * 【or  git add /* 】 【git add --all folder】(把这里所有的文件都加到local git repository )


4) git commit -m " message " (必须得commit一次,-m是message的意思,message写什么都行)

5)git remote add origin http://......myproject.git (在github.com上先建好一个repository,再把URL链接用在这里。
      这样local git repository 和 github.com上的online, git repository  就链接起来了


6)最后再把所有local的上传,
git push origin master  【git push -u origin master

然后网上就应该看到上传的东西了。




git remote -v
是检查目前online repository 是什么路径,
online repository 和 local repository 要对接。

git status
显示状态,

-----------------------------------------------------------------

Set up your project in GitHub Desktop

The easiest way to get your project into GitHub Desktop is to drag the folder which contains your project files onto the main application screen.
Screenshot of drag and drop in Mac app
If you are dragging in an existing Git repository, you can skip ahead and push your code to GitHub.com.
If the folder isn’t a Git repository yet, GitHub Desktop will prompt you to turn it into a repository. Turning your project into a Git repository won’t delete or ruin the files in your folder—it will simply create some hidden files that allow Git to do its magic.
Screenshot of Git init in Mac app

Your first commit

All Git repositories are based on commits—snapshots of your code at a point in time. You need to make at least one commit before you can push your code up to GitHub.com.
Screenshot of committing in Mac app
Navigate to the Changes tab and click Commit to create your first commit. You’ll need to create a new commit every time you change files. Creating a commit is like saving a file—you are telling Git that you’d like to remember this point in history.
Make as many commits as you like locally. No one but you can see those commits until you push them to GitHub.com.

Push your code to GitHub.com

Screenshot of pushing in Mac app
Click the “Publish” button in the upper-right corner and GitHub Desktop will ask you what kind of repository to create:
  • Public repository — Anyone can see a public repository, but you choose who can commit (make changes) to it. You can create as many public repositories as you want on GitHub.com for free.
  • Private repository — By default, only you can see a private repository. You choose who can see and commit to this repository by adding collaborators. Private repositories require a paid subscription on GitHub.com.
Now that you’ve published the repository, you have it in two places:
  • Local repository on your computer — You can work on this repository without an Internet connection using GitHub Desktop. This is where you edit files and make changes to your project.
  • Remote repository on GitHub.com — You can send people links to your repository on GitHub.com so they can see your code and use all of GitHub’s other features (like Issue management and Pull Requests).
Each time you make changes to your local repository, you’ll need to sync your changes (by clicking the button in the upper-right corner of GitHub Desktop) to make sure they show up online.

Getting code from GitHub.com

If you want to get some code from GitHub.com onto your computer or synchronize changes between multiple computers, you’ll need to either pull changes or clone a repository:
  • Pull changes — Click the “Sync” button in the upper-right corner of GitHub Desktop to bring code from an online repository (for example, changes that your co-worker pushed up) onto your computer. Note: This will also push changes you haven’t pushed yet.
  • Clone a repository — Click the “Clone in Desktop” button on GitHub.com to create a new copy of a repository on your computer.

No comments: