简体   繁体   English

如何从GitHub重新创建本地git存储库

[英]How to re-create my local git repository from GitHub

I had a git repository on my hard drive, but had to replace my hard drive and lost my repository. 我的硬盘驱动器上有一个git存储库,但不得不更换硬盘驱动器并丢失了我的存储库。 I have the repository on GitHub, and I used to git push origin master from my local repository. 我在GitHub上有存储库,并且我以前从本地存储库git push origin master

How do I get my repository back from GitHub and get back to where I was? 如何从GitHub取回我的存储库,然后回到原来的位置?

You can simply clone the repository , and you will be back to the last pushed version: 您可以简单地克隆存储库 ,然后返回到上一个推送版本:

git clone https://github.com/username/repository.git

By default, the master branch will be checked out. 默认情况下,将检出master分支。

Use git clone: If you had any non-pushed local changes they will be gone. 使用git clone:如果您有任何未经推送的本地更改,它们将消失。

http://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository http://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何脱水任意完全推送的本地 git 存储库并稍后从远程重新创建它? - how to dehydrate an arbitrary fully-pushed local git repository and re-create it later from remotes? iPhone:如何重新创建XCode内置git存储库? - iPhone: How to re-create XCode built-in git repository? 主要git存储库已删除,我可以从.git目录重新创建它吗? - main git repository got deleted, can I re-create it from a .git directory? 从github克隆了一个git仓库-我如何在我的账户中创建一个新的github仓库 - cloned a git repository from github - how do i create a new github repository into a repository into my account 如何从github服务器在我的服务器上创建git存储库? - How to create a git repository on my server from the github server? git 本地存储库与我的 github 帐户分离 - git local repository is detached from my github account 如何在我在github.com上分叉的项目上重新播放本地Git存储库的提交? - How do I re-play my commits of a local Git repository, on top of a project I forked on github.com? 如何使用本地git仓库填充github仓库? - How to populate a github repository with local git repository? 从github提取新版本时,如何丢弃Git存储库中的本地更改? - How can I throw away local changes in my Git repository when pulling a new version from github? 如何在GitHub上创建本地存储库并上传到存储库? - How to create a local repository and upload to repository on GitHub?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM