How to create a new file in github and add there existing files? - github

I have files in repository. I want them to be grouped inside a folder. How can I do this?
It seems that I need to add new file if I want to create a folder.

From how you worded your question, it seems like you're trying to work on github directly from the website.
The usual way github works is:
if you have a repo on github and you want to modify it, first 'clone' the repo into your local computer,
use these instructions https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository
then just change folder structure like you would normally on File Explorer (windows) or Finder (mac),
then follow the commit instructions and 'push' up your changes to github
use these instructions
check status of your recent changes:
git status
add the files that you want to include in the commit
git add nameOfFile
check status and the file you want to include should now be green
git status
use this to send to github
git push
Overall github docs here:
https://learn.microsoft.com/en-us/training/modules/introduction-to-github/

Related

How to transfer Github Gist to Repository?

I am new to Github. I recently have created a gist https://gist.github.com/8d11e24576c94b2c07a9a48288082588.git and want to transfer it to my repository at https://github.com/Muhammad-Ammar-Masood/Log-In-Page.git.
The simpler approach would be to clone your repository, and copy in it your gist, as a new file.
From there, add, commit and push.
Note that you can, from command-line, list your gists with gh girst list and view the content of a particular gist with gh gist view
gh gist view https://gist.github.com/8d11e24576c94b2c07a9a48288082588.git
(you need to install gh first)
You can also, since yesterday, do it online by going to your repository Muhammad-Ammar-Masood/Log-In-Page, and use GitHub Codespace by typing ..
You can add your gist in the online VSCode there.
You can, download Github Desktop on "https://desktop.github.com/", log in , create a new repository with GitHub Desktop, then choose a local directory on your PC for the newly created repository.
You can go to your Gist and choose to download as zip at the right end of the options
Screenshot of Gist Url and the download button highlighted
You can extract the zip file to your local directory assigned for the newly created repository.
On your GitHub Desktop : You can commit and push the changes of the repository to your GitHub.

what Git Ignore field means in github desktop while creating a new repository

see the Git Ignore option in the below image.What I have to choose, I am creating an ionic-framework repository.
https://i.stack.imgur.com/pBvkd.png
.gitignore is a file which, Git uses to determine which files and directories to ignore, before you make a commit. These files/directories will not be pushed into the repository.
If you have any files or directories that don't need to be pushed into the repository, then you can include them. (a simple example : log files)
If there is no ionic option, you can ignore it, and create it locally on your repo, then push it back to your GitHub repo.
To create it, see https://www.gitignore.io/api/ionic3
It does generate an Ionic .gitignore for you.

New to git--just need to sync one file

I managed to finally get EGit in Eclipse to work (still don't know how) and I've committed/pushed my current project up to GitHub. So far, so good. Looking at it on GitHub's site, I see it wants me to make a README.md file to provide a nice description. Fine, I think, I'll just use the tool it's providing me with to get it started, then have it sync back down to my local computer where I can further modify it and keep it synced.
So I created a quick README.md file on GitHub's site. But now, when I perform a "Pull" action in Eclipse, I am told that there's nothing new to pull, or something like that. Why is it not getting the new file that was created on GitHub's site, and how can I get it so that I can make changes to it whenever I want?
If you have git installed you can use a terminal and type in the root of your repository:
git pull origin master
or you could try checking out only that file:
git checkout README.md

Add new folder with files to github

Probably one simple question. I pushed my first project to github. I've done it with Eclipse with EGit plugin. I've clicked on a project, chose to push remote and uploaded it to git. There I have created readme file online so the structure looks like this:
Git
-- AppFolder
------srcFolder
------libsFolder
------resFolder
------etc etc
-- Readme.md
I have one other folder with screenshots of the app which I would like to have outside my app folder. Something like this:
Git
-- AppFolder
------srcFolder
------libsFolder
------resFolder
------etc etc
-- Readme.md
-- ScreenshotsFolder
------screenshot1
------screenshot2
------etc etc
How can I accomplish that? I don't want to put that folder with screenshots to AppFolder. Thank you.
Locally, just create the ScreenshotsFolder in the same directory level as AppsFolder and README.md.
Then, git add ScreenshotsFolder will add the folder and all of its content (really, all content that is not in your .gitignore file if you have one).
Next just git commit then git push remote_repo remote_branch (ex: git push origin master).
If you aren't doing this via the command line, I'm sure the EGit plugin has some option to add the ScreenshotsFolder and do a commit then push...haven't used EGit myself, though. The steps are the same either way, just a different interface.
Are the files intended to be committed? If not, you could just .gitignore that directory.
edit: if the files are meant to be committed, why can't you just add and commit them like normal, but in new directory?

How do you completely remove a file on github

I've seen the command needed to remove a file and erase it from the history on git. Is there a way to do this with the github website? If not, it looks like I need to know where the file is to do it with a git command. Where does github store the local repositories?
See: https://help.github.com/articles/remove-sensitive-data
To get a local version of the repository, look up the URL from the repo page on Github and clone as explained in the link above.