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

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

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

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

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


当前回答

遵循以下两个步骤:

使用链接:https://github.com/new在线创建存储库 然后使用命令将本地回购链接到远程回购:git add remote origin https://github.com/userName/repo.git 这里是回购。Git将是您新创建的远程repo。

这将非常有效。不需要担心SSH或HTTPS方式。我第一次遇到同样的问题,花了几个小时来解决。 但这对我很管用。

其他回答

你只需要知道几个命令im cmd推或拉任何目录到/从github。 命令来推送/上传任何项目或代码到git集线器。

首先到达需要上传的工作目录或项目目录。

检查正确的工作目录

ls

初始化目录下的git

git init

检查git init是否工作

ls -a //this command shows hidden files

使用上述命令,您将发现文件添加到您的目录。

 ./   ../   .git/ 

上面的命令不是可以跳过的。 现在添加工作目录的文件提交

git add . 

然后使用commit命令并命名该commit以供参考

git commit -m "Commit Name"

在最后一步之前,你需要去github网站,创建一个新的存储库,并复制存储库的url

git remote add main https://github.com/username/repositoryName.git

现在命令上传目录

git push -u main

注意:名称“main”是每个用户都可以更改的名称

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

我认为最简单的方法就是为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

尝试使用Git Bash来推送您的代码/进行更改,而不是直接在GitHub上上传文件(它不太容易出错,有时也很舒服-也需要更少的时间!)要做到这一点,你可以遵循以下步骤:

Download and install the latest version of Git Bash from here. Right-click on any desired location on your system. Click “Git Bash Here”. git config --global user.name “your name” git config --global user.email “your email” Go back to your GitHub account – open your project – click on “clone” – copy HTTPS link. git clone PASTE HTTPS LINK. A clone of your GitHub project will be created on your computer location. Open the folder and paste your content. Make sure content is not empty. Right-click inside the cloned folder where you have pasted your content. Click “Git Bash Here” again. You will find (master) appearing after your location address. git add . Try git status to check if all your changes are marked in green. git commit --m “Some message” git push origin master