Github and some help starting out (Linux)

  • Thread starter member 428835
  • Start date
  • Tags
    Linux
In summary, you added a folder called "cpp" to your repository on github, but when you checked online you didn't see the file. You think you added it successfully, but you need to check with gitstatus to be sure. You can also use VS Code's git extension to check and commit your changes.
  • #1
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
  • #2
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
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
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).
 

FAQ: Github and some help starting out (Linux)

What is Github?

Github is a web-based platform used for version control and collaboration on software projects. It allows multiple developers to work on the same codebase, track changes, and merge code together.

How do I get started with Github?

To get started with Github, you will need to create an account on the website. Once you have an account, you can create a new repository to store your project's code. You can then add collaborators, commit changes, and push your code to the repository.

What is Linux?

Linux is an open-source operating system that is widely used in servers, supercomputers, and mobile devices. It is based on the Unix operating system and is known for its stability, security, and flexibility.

How can I start learning Linux?

There are many resources available for learning Linux, such as online tutorials, books, and courses. You can also try installing a Linux distribution on your computer and practice using the command line to perform tasks and manage files.

How can I use Github with Linux?

Github can be used with Linux by installing the Git version control system on your computer. You can then use the Git commands to clone, push, and pull code from your Github repository. There are also many GUI clients available for managing Github repositories on Linux.

Back
Top