-
打开Git Bash,输入ssh-keygen -t rsa -C “你的邮箱”,生成公钥和私钥。
-
把.ssh文件夹下的id_rsa.pub里面公钥拿出来,打开方式随意,记事本或者文本编辑器都行。
-
回到gitee,在 设置—ssh key密钥 中,把刚刚那串公钥复制进去并添加。(也就是在刚才的窗口中将公匙复制进去,然后一直回车)
-
输入命令 git config --global user.email “你的邮箱”。
-
在Git Bash中进入你的项目目录,输入命令 git remote add origin git@gitee.com:你的用户名/你的项目名.git
-
当您在Git Bash中输入命令 git remote add origin git@gitee.com:你的用户名/你的项目名.git 时,您需要先进入您的项目目录。例如,如果您的项目在D盘的test文件夹中,您需要在Git Bash中输入命令 cd /d/test,然后再输入命令 git remote add origin git@gitee.com:你的用户名/你的项目名.git。这样,您就可以将您的项目与gitee连接并上传您的项目代码了。
-
1.如果出现以下错误:
fatal: detected dubious ownership in repository at 'E:/gulimall' 'E:/gulimall' is owned by: 'S-1-5-21-2849976949-1235090395-1401450243-1001' but the current user is: 'S-1-5-21-1534008097-3564530078-2937417616-500' To add an exception for this directory, call: git config --global --add safe.directory E:/gulimall
使用提示的命令进行解决:
git config --global --add safe.directory E:/gulimall
2.后续可能出现以下错误:
error: remote origin already exists.
下面是解决方案:
这个错误提示是因为您已经添加了一个名为origin的远程仓库。您可以使用以下命令更改您的远程仓库名称: git remote rename origin old-origin 然后,您可以使用以下命令将您的项目与gitee连接: git remote add origin git@gitee.com:superman_cant_fly_Jay/gulimall.git
-
-
输入命令 git push -u origin master,即可上传之前的项目代码。
【Gitee】系统重装后如何连接idea中原有项目到gitee并push新代码
最新推荐文章于 2024-07-04 16:31:23 发布