开发者

How can I upload my project's Git repository to GitHub?

I have installed the Git EXE file for 开发者_开发问答Windows at my machine. I have also created my account at GitHub. My requirement is simple—how do I upload my project, say one folder and two files in it, to GitHub?


First follow these steps to create an SSH key: http://help.github.com/win-set-up-git/

Then create a local repository on your computer and push it to GitHub with these instructions: http://help.github.com/create-a-repo/


Go to GitHub, on the top right press the "+" button, and choose New repository. Give it a name and adjust the settings you want and press *Create repository. After doing so, you should be redirected to a page containing some commands, which means you have been doing everything right until now.

Open your Git repository and go to the folder you want. For example, if the folder's name is "Demo", use the command "cd Demo". After that, type

git init

to create a new Git repository. Then use

git add <the name of the file or folder>

This adds the chosen file to the staging area, telling Git to keep track of that file. After doing so, make a commit by simply writing

git commit -m "(what you want to say)"

After that, type in this command:

git remote add origin https://github.com/<username>/Demo.git.

Change the <username> to your username and the Demo.git to the name you gave your repository. Last, but not least, use this command:

git push -u origin master.

Now if you search up www.github.com/<yourusername>/ <the name you gave your repository>, you would go to the page that contains your published work.

How can I upload my project's Git repository to GitHub?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜