Mark Mueller
Mark Mueller

Reputation: 1

How do I copy code from python into GitHub?

I am trying to copy and paste my code from a web server which was written in python into a new file on GitHub.

I go to my github repository (https://github.com/markus24135/ibmdatascience) and click "add file" then "create new file". Once a new file opens, I paste the code directly in there. However, the code doesn't become color coded as I would see in python (like import doesn't turn green) and when I save the file and then click on it again, I get this error message: "Sorry, something went wrong. Reload?".

Even when I reload I can't get the code to show up. I thought you could just copy and paste code into github instead of pushing it from python to github? Do I have to figure out how to push it?

Thanks! Mark

Upvotes: 0

Views: 1084

Answers (1)

hd1
hd1

Reputation: 34677

I've never used the "add file" feature, what I do to get code into github is:

  1. create a git repository using git init
  2. Add the remote github repository using git remote add origin [email protected]:markus24135/ibmdatascience.git
  3. run git add -A
  4. run git push origin -u main

Upvotes: 2

Related Questions