检查后,我如何上传我的项目的Git存储库到GitHub?,我仍然不知道如何让一个项目上传到我的GitHub存储库。

我创建了一个存储库,并想将我的项目上传到它。

我在存储库页面上查看了某种上传按钮,但我没有看到任何类似的东西。

到目前为止,我已经查看了提供的链接,但仍然一无所获。他们提到了命令行;是Windows命令行还是Git Bash?因为我不能让他们做任何事。

我也尝试使用Git GUI,但是当我选择我想要的文件夹时,它说它不是Git存储库…需要拉上拉链吗?我尝试在文件夹中添加.gitconfig文件,但没有什么不同。


当前回答

下载Sourcetree。

它适用于Windows 7(及更高版本)和Mac,强烈建议通过交互式UI在GitHub上上传文件。

其他回答

按照以下步骤将项目上传到GitHub:

git init Git添加。 添加我所有的文件 Git远程添加origin https://github.com/yourusername/your-repo-name.git 上传的项目从零开始需要git拉源主。 Git拉源主 Git push origin master

我假设你和我一样使用Windows系统,并且安装了Git。您可以在项目目录中通过简单的命令提示符运行这些命令,也可以使用Git Bash。

步骤1:

在Git中手动创建一个存储库。随你怎么称呼它。

步骤2:

进入您的本地项目目录。如果您希望将代码发布到刚刚创建的新存储库中,请确保在项目根目录中没有文件夹名.git。如果有,请删除。 执行命令git init。

步骤3:

运行命令

转到添加 。

步骤4:

运行命令

git commit -m YourCommitName

步骤5:

运行命令

git远程添加YourRepositoryName https://github.com/YourUserName/YourRepositoryName.git

步骤6:

运行命令

git push——set-upstream YourRepositoryName master——force

请注意,我在撰写本文时使用的是最新版本的Git。还要注意,我没有指定要将代码推入的任何特定分支,所以它会进入master。在第6步中,Git会要求您在一个弹出窗口中输入用户名和密码来授权命令。

简单的步骤:git拉源master或main会给出一个致命错误:

无法找到远程参考主机

下面的步骤就可以了。

git init Git添加。 Git commit -m "初始提交" Git远程添加origin https://github.com/yourusername/your-repo-name.git git分支-M main Git push -u origin main

也许你能做的最有用的事情就是阅读在线书籍Pro Git。这是一本相当不错的读物,它为你提供了正确执行事情的概念背景。

We need Git Bash In the Git Bash Command Section: ls It will show your default location. CD "C:\Users\user\Desktop\HTML" We need to assign the project path. git init It will initialize the empty Git repository in C:\Users\user\Desktop\HTML ls It will list all file names. git remote add origin https://github.com/repository/test.git It is your https://github.com/repository/test.git is your repository path git remote -v To check whether we have fetch or push permission or not git add . If you use . then it means whatever we have in the particular folder publish all. git commit -m "First time" git push -u origin master