What is the difference between uploading and cloning? - github

I am new to Github and I do not understand what is the difference between uploading directly a file from your computer by dragging it (Upload files option) and uploading through clone with SSH.
Is the first option just regular file uploader and the second an option that connects your repository with your local environment?
The reason for asking this is that I am trying to upload a .ipynb file but I do not want changes done in my local computer to affect the file I have uploaded. Is that possible?
Thank you in advance.

The drag 'n' drop option on the GitHub website it just a 'shortcut' for committing a newly added file in your (local) repository and then pushing it. After you released your left mouse button and the file is uploaded, the web interface even asks you to enter your commit message and the branch you want to push to.
Once you've uploaded the file via the website, the file on your computer has no relation to the file within GitHub, so changes are not reflected.
But even if you clone, local changes and even commits won't be reflected on GitHub, until you do git push.

Related

New Web Dev person and need help on GitHub

I am new to GitHub and having issues uploading a website.....
When I upload to GitHub, it separates folders (Here is the image of what I am seeing GitHub) and thus website doesn't display properly.
Here is the image of the file on my computer Here is what I am seeing on computer
I attached screenshots, any help would be great....
I am confused af at this point in time
Try To push changes correctly as it doesn't happen usually. Read this:
Open your Command prompt first then move to the particular which here contains your whole website.
Start with
git init (it will initialize your folder to be pushed up or pulled
to git Controls)
then git add . (To add All the files create your
.gitignore file carefully)
git commit -m "Whatever you want to write
us a note about the changes"
then git push -u origin main
Hope Your problem will be solved or maybe something you can only diagnose because you are there sitting and functioning
**Note If there is any folder containing called .git, delete that. Before proceeding the way I mentioned **

How to re-connect a local github repository I completely overwrote?

I have a Unity project that I messed up badly, so I downloaded the zip file of the latest repository I pushed to GitHub, deleted the local files, and dumped the content of that zip in place of the old directory. I thought this would be a seamless transition, but now GitHub Desktop is not recognizing these files as a git repository. I don't know why because there are github-specific files in there. I have made significant changes that I need to save. How do I reconnect this repository? Do I want to hit "Clone Again" or will that overwrite what I have locally with what is in the cloud? Again, I want to push what I have locally to the cloud.
For anybody else having this problem, here is what I did:
Save your local repository into a zip file someplace accessible,
like your desktop.
Completely gut your local directory--delete all
contents within the root folder. GitHub Desktop demands a clear folder to clone into.
In GitHub Desktop, where it says it
can't find your repository anymore, click the button that says
"Clone Again". This will download your cloud repository into your
local directory--the opposite of what we wanted, but at least what
comes next will work.
Delete all the cloned files that are NOT files associated with GitHub. This will prevent extraneous files from being left over when you overwrite your project files.
Copy all the non-GitHub-related files from the zip into the renewed directory.
This will restore the link between directories. Now, IT IS POSSIBLE that I deleted an essential GitHub file and did not notice (since there are at least 4 of them), and simply restoring THAT file from the cloud would fix everything. If you become disconnected like I was, I recommend trying that first in case it works and saves you time. Those are the files that get overwritten by GitHub when local files are updated.

GitHub GUI move folder from one repo to another

I have multiple repositories under my account, and I placed a folder into the incorrect repo.
Is there a way use the GitHub web interface to move that folder from one repo to another?
From GitHub GUI alone, I don't think so.
You can delete files from the web GUI, but you still need to push your folder content from a local cloned repo (the right one this time)
Note: even if GitHub GUI referred to GitHub Desktop, you would still need to push.

Push modified file back to git without fetching

I create a git, pushed a file to it, TempMonitorGPRS.ino from my mac.
I tested the code, got some logs that I wanted to save. So I copied the log results and created a file, manually, in my repo. I made some changes to the .ino file which I want to push back to the repo from my mac. But when I try to git push -u origin master, I get a warning that I need to git pull first to get those files that I created manually, into my local mac. I dont want to get those files. Is there any way for me to continue pushing changes to my .ino file without ever getting those files onto my local computer?

Github Mac App How To Change Default Storage Directory

In the github mac app i am trying to change the default directory of one of my repo's. In the settings screen I only see a place to change the remote repo.
Where do I need to go to change the default location? Sorry if it is very obvious.
So after some trial and error I figured out how to change the location after you have set it up. Apparently it is as easy as just moving the folder that contains the .git. So for example I just moved the website folder into a new directory and the GitHub app was able to track the movement.
Edit 1: The move does not always stick so you might have to try a couple of times.
You manage the local destination of each remote repository you clone at the moment of cloning.
As soon as you click the Clone in Desktop button on a repository's page (on github.com), GitHub for Mac should open up (assuming you've configured the app to be opened up when Clone in Desktop is clicked). When the app opens it first prompts you to choose the location for cloning the repo (cloning means downloading or copying the files). This prompt is where you set the default location for this particular repository on your local machine.
In the interest of users who came here with the same doubt, let me post also my experience.
I wanted to move the GitHub local folders away from the "Documents" folder to free up iCloud space, and because I really didn't need yet another copy of the codes in addition to the one in my machine and in the GitHub servers. That is how I landed in this page in the first place. So I simply moved the folders to a local folder that is not synchronised with iCloud and when I opened GitHub Desktop to confirm if things were working, the app told me "Couldn't local [repository X]." They had a "Locate..." button, which I used to let the app know where the new location was. And I did this for all of my locally cloned repos. That's it, works like a charm now. If you have a lot of repos cloned locally, it might be a one-time hassle to do this, but there's no further action.