同时,我试着把我的项目推到git lap上

eeq64g8w  于 2023-05-21  发布在  Git
关注(0)|答案(2)|浏览(216)

当我把我的项目推到git实验室时,第一个命令是成功的。

git add .
git commit -m "Initial commit",

然后在第三个命令中

git push -u origin main

得到这样的错误,

git push -u origin main     
>>
>>
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我该怎么弥补

2izufjch

2izufjch1#

您缺少的是到push的远程项目的链接。
例如:
您从一个名为my-project的远程项目开始,然后将其clone到本地文件夹:

git clone SSH_or_HTPPS_code_of_my_project

[modify something]

cd my-project

git add .

git commit -m 'first commit'

git push

或者从本地存储库my_repo开始

cd my_repo

git init

git remote add origin SSH_or_HTPPS_code_of_my_project

[modify something]

git pull origin master # if you have files in the remote project

[modify something]

git add .
    
git commit -m 'first commit'

git push --set-upstream origin master
qcuzuvrc

qcuzuvrc2#

不确定您正在执行的过程是什么,但只是为了确保-运行git remote -v时的输出是什么?
你是克隆了一个仓库还是初始化了一个?如果初始化本地存储库,则应将其链接到远程存储库git remote add origin <git-repo-url>

相关问题