Github and some help starting out (Linux)

  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Linux
Click For Summary

Discussion Overview

The discussion revolves around using GitHub on Linux, specifically focusing on issues related to adding directories to a repository and ensuring successful uploads. Participants share their experiences and methods for managing repositories through the command line.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested, Homework-related

Main Points Raised

  • One participant describes their attempt to add a directory named "cpp" to their GitHub repository but finds it does not appear online after checking.
  • Another participant outlines a series of commands they typically use to add files to a repository, emphasizing the importance of using "git add ." to include new files.
  • A participant requests better-quality screenshots to clarify the issue, suggesting that the current images are unclear.
  • There is a discussion about the nature of Git, with one participant noting that Git does not commit folders directly and suggesting creating a ".gitkeep" file to ensure the folder is tracked.
  • One participant mentions that many developers now use IDE integrations for Git, recommending tools like VS Code and GitTree for easier management.

Areas of Agreement / Disagreement

Participants express varying levels of familiarity with GitHub, and while some provide guidance on commands, there is no consensus on the specific issue faced by the original poster. The discussion remains unresolved regarding the exact steps needed to ensure the "cpp" directory is uploaded correctly.

Contextual Notes

There is uncertainty regarding whether the "cpp" directory was committed and pushed correctly, as well as the need for clearer visual aids to assist in troubleshooting.

member 428835
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
 
Computer science news on Phys.org
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.
 
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?
 
Wrichik Basu said:
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).
 

Similar threads

Replies
16
Views
3K
Replies
3
Views
2K
  • · Replies 20 ·
Replies
20
Views
4K
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
3
Views
1K
Replies
2
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K