如何发布Github仓库 [英] How to publish Github repository
问题描述
我需要从计算机上的目录发布Github存储库.
I need to publish a Github repository from a directory on my computer.
我从项目的根目录添加,提交并推送了要发布的文件的原始文件.就是说,我的意思是我单击了创建新的存储库"按钮,并在要发布为我的存储库的项目目录中在终端中键入了所有git命令.有关我使用的命令的列表,请参见下面标记为代码"的部分.
I added, committed, and pushed the origin master of the files I wanted to publish from the root directory of my project. By that, I mean I clicked the "create a new repository" button and typed all the git commands in my terminal while in the project directory I want to publish as my repository. For a list of the commands I used, see the below section labeled "Code."
在终端命令期间我没有看到任何错误.完成后,我在存储库中看到的只是README.md文件而已.
I saw no errors during the terminal commands. When I finished, all I saw in my repository was the README.md file and nothing else.
我试图在终端上检查我的登录名是否与目标存储库的Github用户名匹配.但是我没有在终端上看到任何用于检查登录名的命令.
I tried to check at my terminal to see if my login name matched the Github username of the target repository. But I didn't see any commands for checking the login name at the terminal.
OS/config :在MacBook Air上使用OS X 10.10.5(Yosemite)
OS/config: Using OS X 10.10.5 (Yosemite) on MacBook Air
git init
git add README.md # This is the problem. (See my answer below.) Should be "git add ."
git commit -m "first commit"
git remote add origin https://github.com/"username"/"repository".git
git push -u origin master
推荐答案
这里是对GitHub的基本推送,您会遇到什么样的错误?
Heres a basic push to GitHub, What kind of errors are you getting?
在命令行上创建新的存储库
create a new repository on the command line
git init
git add . //This will add everything in the directory
git commit -m "first commit"
git remote add origin https://github.com/"username"/"repository".git
git push -u origin master
…或从命令行推送现有存储库
…or push an existing repository from the command line
git remote add origin https://github.com/"username"/"repository".git
git push -u origin master
这篇关于如何发布Github仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!