Github and some help starting out (Linux)

  • #1
joshmccraney
Gold Member
2,244
139
Hi PF!

I am trying to learn github on Linux. I made a repository online called Leetcode, and added a folder "python" there. I wanted to try adding the directory "cpp" to the repository via the command line, so I thought I did this via the add command. To check and see if it indeed uploaded, I executed git status, and sure enough the file "cpp" does not appear, which makes me think it has been successsfully added to the repo "Leetcode". However, when I check online I do not see the file "cpp". The attached image should help if I've been unclear.

What should I do to ensure these directories are appropriately uploaded? Thanks so much for your help!
Screenshot from 2022-11-15 22-23-34.png
 

Answers and Replies

  • #2
Borg
Science Advisor
Gold Member
2,065
3,434
I'm definitely no expert at Github but I do use it all the time. When I want to add code to a repository, I do the following steps:

git status - Check on the state of the existing code changes (not new)
git add . - Add any new files (note the period)
git status - This will now show the files that you've added also
git commit -m "My checkin comment goes here." - Everything is prepped at this point.
git push - This actually pushes your commit to the github repo.
 
  • #3
Wrichik Basu
Insights Author
Gold Member
2022 Award
2,026
2,181
First, we need better screenshots. If I zoom into that, everything is hazy. Preferably, one window in one screenshot. All of us don't have large monitors.

Assuming you have committed the cpp folder, have you pushed it to remote?
 
  • #4
pbuk
Science Advisor
Homework Helper
Gold Member
4,040
2,373
Assuming you have committed the cpp folder, have you pushed it to remote?
There is no such thing as "committing a folder", git only works with files. If you don't have anything to put in the folder for the time being create an empty file called ".gitkeep" in the folder and add and commit that.

In 2022 99% of most developers' interactions with git are through an IDE integration. Download VS Code and its git extension (I also like GitTree since similar functionality was removed from GitHub).
 

Suggested for: Github and some help starting out (Linux)

  • Last Post
Replies
12
Views
260
Replies
26
Views
680
Replies
3
Views
754
Replies
4
Views
530
  • Last Post
Replies
18
Views
576
Replies
6
Views
664
  • Last Post
Replies
2
Views
634
  • Last Post
Replies
18
Views
1K
Replies
18
Views
904
Replies
7
Views
843
Top