How do I push newly created files?


#1

I started a new file for a GitHub repo in my Atom, but I can’t find half the buttons. Here are the steps I went through.

  1. I cloned my repo down from GitHub.
  2. I created a new file in Atom
  3. I saved the file in Atom as a .py file, so Atom would know it was Python and color the syntax accordingly
  4. Now I can’t find the push/pull buttons. However, the created-on-GitHub README.md file. does have the buttons. What the heck is wrong?

#2

I think you need to commit the file first (bottom-right corner should say “1 file”). It’s a new file right now that isn’t recognized by Git. Once you commit it, then Git will know to track it.

Also, I think you may have some terminology mixed up, so I’ll try to explain:

  • “Commit” means saving your changes with Git (as in, you’ll need to save your new Python file with Git for it to recognize the file and change it)
  • “Push” means to push your saved changes to a remote server (in this case, GitHub).
  • “Pull” updates your local files with the changes from GitHub.

So basically, before you can push anything, you need to commit your changes first.


#3

The button says 0 Files, and asks me to initialize a new Git repo when I click it.


#4

It sounds like your project folder (the top-most folder in your tree view) is not a git repo. Mind posting a screenshot of Atom?


#5

Here:


#6

Here’s my screen:

  1. If you look at the red arrow, that’s what the git repo folder looks like. Yours has the book (which means that Atom sees it as a repo), but it doesn’t have the [branch name], which is weird. What do you see when you open the command line, navigate to Wolfie\, and type git status?

  2. I’m not sure why you created Wolfie Main.py inside atom\app-1.18.0, but that’s very dangerous. Those folders get deleted when Atom updates and you shouldn’t save anything there.

  3. You seem to have made your github\ directory a repo itself. You can undo that by deleting the .git folder.

  4. If you look at the green arrow in my screenshot, you’ll see up and down arrows that allow me to quickly push and pull. The fact that you don’t have them may be related to the fact that there’s no branch name on your tree view or status bar.


#7

OOOPs. So how can I fix it?


#8

You can start by answering my question. Everything I can give you is based on what you give me first, and I’m not able to tell you anything more unless you give me more information.


#9

Sorry. Here are answers.

  1. I type git status, with output:
    On branch master
    Your branch is up-to-date with ‘origin/master’

2.The reason is because when I saved the file locally by pressing Crtl+S, that was the default folder for saving in.
3. I’ve tried but it rebukes me for trying to delete a root file.
4. I have no clue where the master branch button is.


#10

OFF TOPIC

Very much like your configuration of ATOM. Very nice!


#11

This is expected, so your git repo doesn’t appear to be the cause.

I’ve tried but it rebukes me for trying to delete a root file.

From the command line, try del /F /S /Q .git.

I have no clue where the master branch button is.

It’s my hope that, by eliminating all the things I notice that are unusual, the [master] will reappear.

Thanks. :slight_smile: