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

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

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

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

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


当前回答

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

其他回答

在GitHub上创建一个新的存储库。为避免错误,请不要初始化 包含README、license或gitignore文件的新存储库。你可以 在你的项目被推送到GitHub后再添加这些文件。开放 终端(Mac用户)或命令提示符(Windows和Linux用户) 用户)。 将当前工作目录更改为本地项目。 将本地目录初始化为Git存储库。 git init #在新的本地存储库中添加文件。这将为第一次提交准备它们。

git添加 #在本地存储库中添加文件,并将其提交。要取消文件,使用'git reset HEAD YOUR-FILE'。提交在本地存储库中暂存的文件。

git commit -m '第一次提交' #提交跟踪的更改,并准备将它们推送到远程存储库。要删除这个提交并修改文件,使用'git reset——soft HEAD~1'并再次提交并添加文件。

在GitHub存储库的快速设置页面的顶部,单击复制远程存储库URL。在你的GitHub仓库的快速设置的顶部 页,单击,复制远端存储库URL。 在命令提示符中,添加将在其中推送本地存储库的远程存储库的URL。

$ git远程添加源远程存储库URL #设置新的远程git远程-v 注意:GitHub for Windows用户在这里应该使用命令git remote set-url origin而不是git remote add origin。将本地存储库中的更改推到GitHub。

$ git push origin master #将本地存储库中的更改推到指定为原点的远程存储库。

源代码属性:使用命令行将现有项目添加到GitHub

使用Git的最佳方式是实际启动giting。试试这个网站,它会让你一步一步地了解在命令行上执行功能的基本方法,以便在GitHub上推送项目。

这个叫做try.github.io,或者你也可以参加Codecademy的课程。

Open Git Bash. Change the current working directory to your local project. Initialize the local directory as a Git repository: $ git init Add the files in your new local repository. This stages them for the first commit: $ git add . Commit the files that you've staged in your local repository: $ git commit -m "First commit" At the top of your GitHub repository's Quick Setup page, click to copy the remote repository URL. In the Command prompt, add the URL for the remote repository where your local repository will be pushed : $ git remote add origin remote repository URL Push the changes in your local repository to GitHub: $ git push origin master

我认为最简单的方法就是为Eclipse安装Git插件。它的工作原理或多或少与Eclipse CVS和SVN插件相同。

简单的步骤: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