Restoring a link to an existing repo


#1

I’m an inexperienced user coming to groups with Atom and GitHub (as a techwriter, rather than as a developer. I don’t have much familiarity with command line interaction or Git concepts although I’m trying to acquire it.) Anyway, I had created a private repo and had been using it as a sandbox - trying things out and learning as I go. But I made the mistake of changing the directory structure which housed the local version of the repo on my Mac. When I opened the project in Atom, it had lost its connection to the GitHub version, even after I changed the directory names back to what they had been. I then tried to clone/download the repo, but neither worked.
Cloning doesn’t work, because of an authentication issue (I think because I have two-factor auth on, which is required by my contract). Downloading the zip file didn’t work, because again Atom doesn’t recognise the link between the download and the GitHub repo. Any tips or guidance appreciated.


#2

What precisely did you do with the directory structure? Where is the .git/ folder currently? When you open the project folder in the Terminal and type git remote -v, what do you see? When you type git status, what do you see?


#3

I had a folder on the desktop, with a sub-directory containing everything.

I took the subdirectory out of the folder and put it on the desktop, then put it back again.

If I run either of those commands, I get ‘fatal: not a git repository (or any of the parent directories): .git’

The contents of the directory seems on face value to be unchanged.


#4

If you have hidden files hidden, you should unhide them. Then tell me if there are any folders called .git/.


#5

No, there’s no hidden files in the folder that has lost the connection to GitHub. (There are hidden files in similar folders.) I’m not clear on what I did that deleted them; at the time I was trying to figure out how to run the site in Docker, that might have done something to the directory.


#6

If you don’t see it (and it didn’t end up on the desktop somehow), you might need to rebuild the repo. If you can’t clone it, try creating a new folder and running git init, then git remote add origin http://github.com/texterity/my-repo and git pull origin master.


#7

sim tem como mas primeiro contate o help do Github. Eles lhe dirão se é possível ou não se for possível te dou uma ajudar.
meu celular: 75988650857

/fica tranquilo os problemas na informática foram feitos para aprender. isso é comum

eu perdi 08 anos de trabalho porque perdi meu HD externo. o que fiz comprei outro HD e comecei do zero.

Abraços

Cristiano Marques


Livre de vírus. www.avast.com.


#8

Thanks! I think I will have to rebuild. Actually it’s the fact that there are hidden files that are associated with the repo that is the takeaway here. Fortunately in this case the repo is only a sandbox so it’s part of the learning.


#9

Keep that setting disabled and you’ll find that Mac uses a lot of hidden files. Programs will often create files that start with . (or “dotfiles”) to store configuration data or session memory. The .git/ folder retains the repo’s entire history plus all repo-specific settings like what the remotes are.


#10

Well I might be pushing my luck here, but having re-created all my content in a new private repo and publishing it via Pages - so far so good, I have only one nagging issue. It is that I had inadvertently created a branch called Backup in my repo whilst messing about in GitHub desktop. Realising that, I then successfully merged backup into master, so the repo now has one branch. But in the Git status bar at bottom right, Atom is still looking at ‘backup’ even though that branch no longer exists. If i click on the dropdown, I can’t select and I think if I enter it as a name, it will create a spurious copy. So how do I adjust that config to that Atom is synched to the correct branch?


#11

I think it might be in the HEAD file which currently is <ref: refs/heads/backup>. Can that be manually overwritten to <ref: refs/heads/master>?


#12

Oh joy. I solved it myself. It’s amazing the things you can find when you google the errors you’re getting. Thanks all for the input.


#13

Yeah, git is confusing at first but there’s a lot of high-quality help available about it. I learned about git through messing up and Googling, and now I mostly just look at git-scm.com for everything (like to remember what syntax to use when I haven’t touched git for four months).