美文网首页
git上传已有项目到码云

git上传已有项目到码云

作者: 小陈学coding | 来源:发表于2018-08-15 14:35 被阅读0次

    在云端新建项目后在本地项目目录下依次输入:

    • git init
    • git remote add origin https://gitee.com/xxxx/xxxx.git(你的远程项目路径,这里拿码云做一下样例)
    • git add .
    • git commit -m "xxxxx"
      (commit的时候可能需要你输入邮箱和名字,操作如下:)
    • git config --global user.email "helloworldxxx@qq.com"
    • git config --global user.name "xxx"
    • git push origin master
      然后输入你的码云账号和密码就可以上传成功了。
      完成。

    git项目从云端下载到本地:

    • git clone xxxxx(xxxxx为你的远程url)
      项目更新好后需要同步到远端,操作如下:
    • git add .(添加所有文件到本地库)
    • git commit -m "xxxxx"(更新推送到本地库,双引号内是提交带的标注信息,方便回退时候看)
    • 这里需要注意:养成好习惯需要进行git pull命令,有时候需要git pull origin master,根据你的使用git平台决定。但是由于我经常一个人多个电脑协同工作,别的地方没有进行更改就不需要这一步。也可以直接执行下一步,提示错误后再运行此命令。
    • git push origin master(需要注意你当前分支,这里拿master分支作为样例,如果是其他分支就得把master替换掉。)
    • 查看当前分支的命令为:git branch,会列出当前所有分支,并在你所在的分支前有*号标识
    • 新建分支并且切换到新的分支命令为git checkout -b xxx,xxx为你新建的分支名,单纯切换到已有分支命令为git checkout xxx

    mac用户的DS_Store文件问题

    转载自https://www.jianshu.com/p/debaa1cde660
    这里作记录保存:
    删除项目中的所有.DS_Store。
    find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
    将 .DS_Store 加入到 .gitignore
    echo .DS_Store >> ~/.gitignore
    更新项目
    git add --all4.git commit -m '.DS_Store banished!'
    删除当前目录及其子目录下的所有.DS_Store 文件
    find . -name '*.DS_Store' -type f -delete
    禁用或启用自动生成禁止.DS_store生成
    defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
    恢复.DS_store生成
    defaults delete com.apple.desktopservices DSDontWriteNetworkStores

    相关文章

      网友评论

          本文标题:git上传已有项目到码云

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