美文网首页
如何把本地项目上传到github上

如何把本地项目上传到github上

作者: 不怕天黑_0819 | 来源:发表于2020-11-11 17:00 被阅读0次

    首先使用Idea 创建自己的项目。
    之后在当前项目路径下执行如下命令(需自行完成密钥生成并上传到github上)。

    git init
    git add .
    git commit -m "first"
    git remote add origin git@github.com:bupt-yjw/kitlin_learning.git
    git push -u origin master 
    

    如果出现以下报错

    git@github.com: Permission denied (publickey).
    fatal: Could not read from remote repository.
    

    但是自己已经生成了相应的公钥并上传到了github上,则可以执行如下命令

    git-add ~/.ssh/{你的公钥}
    

    添加gitignore后文件仍然被追踪

    执行如下命令即可。

     git rm --cached dir_name/file_name
    

    原因是添加了 .gitignore 忽略这些路径后, 由于这个路径是已经增加到过仓库管理中,

    所以尽管已经在 ignore 列表里,依然会被 git trace 到每个文件的变化。这时只需删除已缓存的trace就可以了。

    相关文章

      网友评论

          本文标题:如何把本地项目上传到github上

          本文链接:https://www.haomeiwen.com/subject/cytybktx.html