Home > Software design >  How should I download my git repo to newly setup PC?
How should I download my git repo to newly setup PC?

Time:08-18

I backed up my local repo of my old pc to GitHub, I have reinstalled windows and installed git in it ,I now want to download my files and folders I backed up on GitHub. How should I do it ?

I have neither done any initialisation nor configured username and email.

Should I initialise and set a new local repo and ssh key and clone the GitHub repo ? Will I face any problems in future while updating the repo ?

Also if possible I would like to use my old ssh key and same branch as I heard cloning would setup a sub branch.

I would like to inform that I am still new to git and github, not a regular git and github user so knowledge is limited on the topic.So please suggest a solution accordingly.

CodePudding user response:

First set up your username and email in your local git setup, Open a git bash and run these commands…

git config --global user.name "YourUserName"
git config --global user.email "[email protected]"

Now, Just clone the repos that you want from your GitHub account. Using the command

git clone "URL of your repo"

If you can't find the repo URL. Refer this screenshot. Repo URL IMG

Do it for all project repositories.

For Authentication while cloning your repo (if it is private) or pushing the changes, if you don't have personal access, create another token from Profile->Settings->Developer Settings->PersonalAccess Token->Generate New Token. (Give the required permissions to this token).

Rerer this tutorial to learn git and GitHub.

PS: It will not change any configuration in your GitHub Account, Neither it will alter anything in your project branch settings.

Hope This Will Help You :)

CodePudding user response:

As long as you have restored your %USERPROFILE%\.ssh folder with its original content, you should be able to clone/push/pull your GitHub repositories on your new PC.
And that, without "any problems in future".

Once clone, git swich yourOldBranch and go on working.

The git config --global user.name/email is to be done only if you did not restore your %USERPROFILE%\.gitconfig global Git config file.
And it is only for commit authorship (it plays no role in GitHub remote authentication)

  • Related