Reputation: 31
I just want to upload some files to my already existing github.com account.
I'm perplexed by that push-pull github instructions and would be very grateful if someone just instructed me (in a pedestrian way) how to put a new file in an already existing directory at my github account.
I'm a Debian user and with the other servers I just make use of sftp [email protected] and then cd directory and then put file
What is a direct translation of this procedure for a github server?
What I need is that myRepo = XYZ contains no files (apart from, say, README) but only a number of directories dir1, dir2, dir3, ,,, each containing files and subdirectories dir11, dir12, ,,, dir21, ... and I simply cannot find out how to to do that.
On my Supercomputer account I made a git directory and on Github XYZ repository ("user-me" is for my real user name)
git clone https://github.com/user-me/XYZ
Cloning into 'XYZ'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
On the supercomputer:
cd XYZ
mkdir dir1
git add dir1
But then:
git commit
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
git push
Username for 'https://github.com': user-me
Password for 'https://[email protected]':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Mladen-Pavicic/MMPH/'
With the token it goes through:
git push
Username for 'https://github.com': user-me
Password for 'https://[email protected]':
Everything up-to-date
But there is no change in https://github.com/user-me/XYZ
I also tried git commit dir1. The same.
What am I doing wrong?
Upvotes: 1
Views: 165
Reputation: 1323553
If you want the content of a folder to be pushed to a new GitHub repository, the simplest option is to use the GitHub CLI command gh repo create
.
First, install gh
.
Second, authenticate yourself with gh auth login
Third:
gh repo create my-project --source=. --push
It will do all the work for you:
a colleague of mine formed some directories and added some files to my account.
That means you must first git clone the repository from your account:
cd /path/to/empty/folder
git clone github.com/yourAccount/yourRepo
Now I obtained new files through calculations on a supercomputer which I should put to Git to be available to scientists as referred in my recent published paper.
Assuming you have copied those files in /path/to/parent/newData
, you can go to your local clone and add them:
cd /path/to/empty/folder/yourRepo
git --work-tree=/path/to/parent add newData
git commit -m "add new data"
git push
Upvotes: 1