上传本地项目到github

    xiaoxiao2021-03-31  39

    切换到你要提交的工程的根目录,执行 $ git init $ git add . $ git commit -m "Initial commit" $ git status #查看当前的git状态 $ git log #查看git日志 访问github,然后创建一个仓库,这里要注意的是你创建的仓库要和你的工程文件名相同 $ git remote add origin git@github.com:<username>/your_app.git $ git push -u origin master 如果执行第一条命令的时候提示: fatal: remote origin already exists. 只需执行以下命令再重新执行上面的两个命令即可 git remote rm origin 如果执行以上命令提示: error: Could not remove config section 'remote.origin' 那么,在C:\Users\<your computer name>\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\etc找到一个gitconfig,把里面的[remote "origin"]删掉就好了,接着再运行以上命令。 如果git提示: updates were rejected because the tip of your current branch is behind its remote counterpart 可以执行以下命令(注意:会将未merge的更新丢弃,如果是第一次上传项目,应该是没关系的): $ git push origin master --force
    转载请注明原文地址: https://ju.6miu.com/read-665471.html

    最新回复(0)