Moving Local Repository

The computer I have been using to maintain my github repository died. I had all the files on it backed up, of course and I copied them to a new system. I am trying to move maintenance to the new system with the same file structure but I am getting errors that I do not understand.

git commit -m ‘2020_10_05’
On branch master
Your branch is up to date with ‘origin/master’.

Changes not staged for commit:
(use “git add/rm …” to update what will be committed)
(use “git restore …” to discard changes in working directory)
modified: .gitignore
modified: .htaccess
…several hundred more files which I do not understand as “modified” since they are identical to the originals except possibly for changed dates.

Untracked files:
(use “git add …” to include in what will be committed)
Articles/FrenchOccupationsen.html
Canada/DeathRegDetail.js
…a lot more files

I tried addressing the “untracked files” by for example: git add Canada/* but they still show up as untracked.

git push -u origin master
Username: jcobban
Password :
To https://github.com/jcobban/Genealogy.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘https://github.com/jcobban/Genealogy.git
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.

I am afraid to do a git pull/fetch/restore because I do not want to override the versions of the files on my local system with contents from GitHub. Do I have to create a complete backup copy of my local repository, do a git pull/restore to make git happy, and then restore the backup?

In general, moving a whole git repository shouldn’t cause issues. The message when you try to push looks like your backup is older than the version on Github, because the Github repository has commits that aren’t in your local copy.

The safest thing to do would be to create a fresh clone, and compare the changed/missing files to see which version you want to keep.

Thank you. It is not clear from the documentation how to “create a fresh clone”. I created an empty directory on my support system. I looked at the documentation of git clone but while undoubtedly useful for an expert, for someone like me who just created my one repository to share my personal family history project work, I am confused.

git clone
fatal: You must specify a repository to clone.

But I do not understand the examples of repository URL in the official GIT documentation of git clone or in any of the examples on other help sites. For example the page “Which remote URL should I use?” on Github says “The https;// clone URLs are available on all repositories …” but does not tell me how to obtain a clone URL. I kept searching and finally found a page “Cloning a repository” which tells me how to get the URL from GitHub. So I issued “git clone https i am not permitted to include URLs in the post //github.com/jcobban/Genealogy.git” which seems to work, except that it created an extra level in the file hierarchy. For example where previously the local repository contained a series of folders, now those folders are all inside a new folder “Genealogy”.

git clone https i am not permitted to specify URLs
Cloning into ‘Genealogy’…
remote: Enumerating objects: 7256, done.
remote: Total 7256 (delta 0), reused 0 (delta 0), pack-reused 7256
Receiving objects: 100% (7256/7256), 1.32 GiB | 1.98 MiB/s, done.
Resolving deltas: 100% (3556/3556), done.
Updating files: 100% (3533/3533), done.

This is inconvenient for me. My application implements a web site so I use the local repository as the directory pointed to by the Apache server on the development machine so I can make changes to the local repository, test them with the local Apache server, and if the change works I want to push the changes to GitHub. So I delete everything out of the target directory and issue:

git clone https I am not permitted to specify URLs .
Cloning into ‘.’…
remote: Enumerating objects: 7256, done.
remote: Total 7256 (delta 0), reused 0 (delta 0), pack-reused 7256
Receiving objects: 100% (7256/7256), 1.32 GiB | 2.36 MiB/s, done.
Resolving deltas: 100% (3556/3556), done.
Updating files: 100% (3533/3533), done.

But all of the files now have the timestamp reset, so I cannot tell which files are older than the copies in my working directory. I will have to overwrite ALL of the files in the local repository because I don’t know the date that each file in the repository was last updated.

It seems to me that losing the personal computer that contains the local copy of a repository is something that must happen frequently to all developers, and there should be an easier way to recover.