IntelliJ IDEA配置GitHub上传项目

发布时间 2023-07-23 10:32:01作者: Cocoicobird

保证本地已安装 \(Git\)

一、配置GitHub账号

新建项目,\(File\rightarrow Settings\rightarrow Version\ Control\rightarrow GitHub\) 添加 \(GitHub\) 账号
image

二、配置公钥

打开 \(Git Bash\) 输入命令 ssh-keygen -t -rsa -C "Personal Email",将根据指示到对应的路径(一般是C:\Users\用户名\.ssh)下,将 \(id\_rsa.pub\) 内的内容粘贴到 \(GitHub\)\(Settings\rightarrow SSH\ and\ GPG\ Keys\rightarrow New\ SSH\ key\)
image

此部分主要是解决后面 \(Share\ Project\ on\ GitHub\),并将项目 \(Push\) 时所遇到的问题
image

三、上传项目至GitHub

点击 \(VSC\rightarrow Create\ Git\ Repository\),然后右键项目目录,点击 \(Add\) 将项目添加到暂存区,然后再点击 \(Commit Directory\)
image
然后 \(Share\ Project\ On\ GitHub\),在 \(GitHub\) 创建 \(Repository\)
image
\(Push\) 推送即可

四、参考

idea新建springboot项目后上传到github上面
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.