Uploading Folder with images to github - version-control

As the title states I was uploading my project to github ( https://github.com/siddhartha-ramesh/FilmReview.git ), but I am stuck here. I cant upload a directory called img to github can anyone help me how to do that. I am not using any gui. Can I create a new folder in github.com just the way I can create new files?
This is what that is happening:
siddhartha#siddhartha-Inspiron-545s ~/Desktop/Untitled Folder $ git remote add origin git#github.com:siddhartha-ramesh/FilmReview.git
siddhartha#siddhartha-Inspiron-545s ~/Desktop/Untitled Folder $ git push origin master
The authenticity of host 'github.com (204.232.175.90)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,204.232.175.90' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
siddhartha#siddhartha-Inspiron-545s ~/Desktop/Untitled Folder $ cd ~
siddhartha#siddhartha-Inspiron-545s ~ $ cd .ssh
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ ssh-keygen -t rsa -C "siddhartharamesh#gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/siddhartha/.ssh/id_rsa): key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in key.
Your public key has been saved in key.pub.
The key fingerprint is:
#key here
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ cd /home/siddharhta/.ssh
bash: cd: /home/siddharhta/.ssh: No such file or directory
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ cd /home/
siddhartha#siddhartha-Inspiron-545s /home $ cd *
siddhartha#siddhartha-Inspiron-545s ~ $ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
siddhartha#siddhartha-Inspiron-545s ~ $ cd ..
siddhartha#siddhartha-Inspiron-545s /home $ ls
siddhartha
siddhartha#siddhartha-Inspiron-545s /home $ cd siddhartha/
siddhartha#siddhartha-Inspiron-545s ~ $ cd .ssh
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ ls
key key.pub known_hosts
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ cat key
-----BEGIN RSA PRIVATE KEY-----
-----END RSA _________________
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ ls -a
. .. key key.pub known_hosts
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ cat key.pub
ssh-rsa
#key here
siddhartha#siddhartha-Inspiron-545s ~/.ssh $ cd ..
siddhartha#siddhartha-Inspiron-545s ~ $ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
siddhartha#siddhartha-Inspiron-545s ~ $ cd Desktop/
siddhartha#siddhartha-Inspiron-545s ~/Desktop $ ls
Aptana_Studio_3 C_C++ Codes key Untitled Folder WS
siddhartha#siddhartha-Inspiron-545s ~/Desktop $ cd Untitled\ Folder/
siddhartha#siddhartha-Inspiron-545s ~/Desktop/Untitled Folder $ ls
film_review
siddhartha#siddhartha-Inspiron-545s ~/Desktop/Untitled Folder $ git remote add origin git#github.com:siddhartha-ramesh/FilmReview.git
fatal: remote origin already exists.
siddhartha#siddhartha-Inspiron-545s ~/Desktop/Untitled Folder $ git push origin master
To git#github.com:siddhartha-ramesh/FilmReview.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:siddhartha-ramesh/FilmReview.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

If you have your folder with your files (pictures in this case) in your local repo (cloned of your github repo), all you need to do to see that folder on GitHub is:
cd /path/to/that/folder
git add .
git commit "add folder with pictures"
git push
# or, if this is your first push:
git push -u origin master
In other words, you add all the files in that folder, and push them.
Instead of trying to add a remote, clone your GitHub repo first, add content in the local clone and push.
Don't use ssh first, use a simpler url based on https, and your login/password:
git clone https://siddhartha-ramesh#github.com/siddhartha-ramesh/FilmReview
cd FilmReview
git config user.name siddhartha-ramesh
git config user.email (your email address used on GitHub)
# add your files
git add .
git commit -m "Add folder"
git push -u origin master
# the next push can be simply 'git push'

GitHub's UI in this respect has not changed in all of these years. If you want to add directories via the GitHub UI, you have to do this:
Select Add file.
Don't pick upload file like you'd think. Instead, select "Create new file".
Up at the top where it says your project name, you should see "Name your file...". Instead of typing the name, type the directory name you're wanting to add and instead of hitting enter, type "/".
Now you need to either add a real file to that directory or just create a fake file name with fake contents. In my case, I just titled it "test.js" with "test" on line 1.
Now, you need to commit the file.
GitHub will create a directory and will upload your new file.
Now if you want, you can delete the test file and your new directory will remain.
Caveat: I'm not sure if you can create a nested directory two levels deep using the "/" trick or not.

Related

Window 10 connection of Github , SSH issues

I am trying to connect git to GitHub. I am using window 10.
The SSH directory is not available.
$ cd .ssh
bash: cd: .ssh: No such file or directory
How can I connect the git to github?
Screenhot of git to github ssh connection problem
Windows 10 systems with build 1803 or newer and Windows Server 2019 come with an implementation of OpenSSH that's enabled by default. Some older versions may have this as an optional component that needs to be installed before it can be used.
Looks like in your case it may need to be installed (see if the folder "C:\Windows\System32\OpenSSH" exists and has files such as "ssh.exe" in it). If it is installed, then that directory needs to be added to the search path (type "echo %PATH%" in the command prompt window to see if it's in there).
Installation
Click on the "Settings" gear in the left pane of the Start Menu.
Click on "Apps".
Click on "Optional features".
Look in the list. If you do not see "OpenSSH Client", click "Add a feature".
"OpenSSH Client" and click "Install".
On analyzing deeper into the issue, it looks like you are searching or trying to cd to .ssh on the desktop which won't work.
Additionally, it looks like you are doing cat to a file that may not have existed as you have never generated public-private key pair(See ssh-keygen command for details)
Just try typing ssh and press enter to see that if it is actually the problem with ssh.
It should give output as(or similar to) :-
$ ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user#]host[:port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] destination [command]
The .ssh directory is generally not available.
Not until you create it and use it with ssh-keygen (the one packaged with Git for Windows at C:\Program Files\Git\usr\bin\ssh-keygen.exe)
From a simple CMD:
cd %USERPROFILE%
mkdir .ssh
C:\Program Files\Git\usr\bin\ssh-keygen.exe -t rsa -P ""
You will get a:
%USERPROFILE%\.ssh\id_rsa (private key)
%USERPROFILE%\.ssh\id_rsa.pub (public key)
Copy the latter (the public key content) to your GitHub profile: that is how you associate Git to your GitHub account.
From there, you can open a Git bash session, and git clone using an SSH URL.
git clone git#github.com:me/myRepository

Upload file by git lfs correctly

I tried to upload large file ( 240mb ) to github by lfs by using
- git lfs install
- git init
- git remote add origin "my repo url"
- git lfs track "*.weights"
- git add yolov3.weights
- git commit -m "test"
- git push -u origin master
after uploaded i found the file content
versionversion https://git-lfs.github.com/spec/v1
oid sha256:c49c28814dc8bcd2c48aac1c3e41c92a183cf9b282f6ca4c05f3d99393137952
size 246305388
And not working but the size still 240 mb
How to upload the file right or what is the wrong?
Did you try pushing the code using this command ?
git push origin <branch name> --force
HTTPS protocol can sometimes be unreliable when it comes to pushing large files . It may break unexpectedly
why dont you try pushing the code via SSH method ?
Run these commands below ::
ssh-keygen -t rsa -b 4096 -C "<email id>"
notepad ~/.ssh/<required key>.pub
// paste this public key into your github account
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<required_key>.pub
You can learn more about the ssh protocol in this article

GIT push with SSH

I am having create difficulty finding reliable information on creating SSH keys in order to remove the need for username and password when doing git push and pull for a main repo and separate nested repos.
To make sure I have no existing errors deleted them from
https://github.com/settings/keys
And then followed this guide which in a nutshell advises:
Check for existing, I deleted all from here as well
ls -al ~/.ssh
then (accepting defaults with no passkey)
ssh-keygen -t rsa -b 4096 -C "your_email#example.com"
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
clip < ~/.ssh/id_rsa.pub
and pasting key at https://github.com/settings/keys
The guide seems to end here, however attempt to push the repo gives:
fatal: HttpRequestException encountered.
An error occurred while sending the request.
Username for 'https://github.com':
What steps have been missed here please.
Attempting to push via git bash

How to use deploy ssh key to clone private repos using Chef 12 on AWS OpsWorks

I could clone public repos using Chef 12 on AWS OpsWorks as follows:
execute "get code" do
user "root"
cwd node['conf-cookbook']['project_root']
command "git clone #{app['app_source']['url']}"
end
but I don't know how to use deploy ssh key to clone private repos - I have searched a while and see a potential solution as follows:
git node['conf-cookbook']['app_dir'] do
repository "ext::ssh -i #{app['app_source']['ssh_key']} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no #{app['app_source']['url']}"
checkout_branch "master"
action :sync
end
which did not work with the error msg:
---- Begin output of git ls-remote "ext::ssh -i -----BEGIN RSA PRIVATE KEY----
MIIJKQIBAAKCAgEApaViIRinBrusrE....[key detail]7xAOmo3NAmqcPxdrOI+hZJHh5KRvrQPLHY
-----END RSA PRIVATE KEY----- -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git#github.com:harrywang/app-main.git" "HEAD" ----
STDOUT:
STDERR: Warning: Identity file -----BEGIN not accessible: No such file or directory.
ssh: Could not resolve hostname rsa: Name or service not known
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Any help? Thanks!
the following works according to #coderanger's suggestion:
application node['conf-cookbook']['app_dir'] do
git app['app_source']['url'] do
deploy_key app['app_source']['ssh_key']
end
end
-i takes a path to a key file, not the actual key data itself. Use the application_git cookbook for setting up deploy keys with Chef.

How to do 'fossil' commands on relative directory?

I want to keep my linux config in fossil scm system.
Here is what I did at initial stage.
$ cd /
$ fossil new b.fsl
$ fossil open b.fsl
$ fossil add etc/group
$ fossil add boot/grub/menu.lst
$ fossil ci -m 'init commit'
I want do do things like (operate like hg/git).
$ cd etc
$ fossil status group
$ fossil add motd
It will show error message:
fossil: current directory is not within an open checkout
So, my temp dirty solution is
$ cd /
$ fossil status etc/group
$ fossil add etc/motd
$ fossil add /etc/motd # this line will cause problem
For my git/hg experiences, it should work.
$ cd /
$ hg init
$ hg add etc/group boot/grub/menu.lst
$ hg ci -m 'init commit'
$ cd etc
$ hg status group # it works
$ hg add motd # it works too
Before the command
$ fossil new b.fsl
Type the command
$ cd etc
If you want the fossil repo stored in another folder, change the commands
$ fossil new b.fsl
$ fossil open b.fsl
to
$ fossil new path_to_repo/b.fsl
$ fossil open path_to_repo/b.fsl
All mentioned commands "add" and "status" and all fossil commands related to the checkout must be executed when the current directory is set somewhere inside the directory tree of the checkout.
You can't specify the checkout directory yourself as a command line option.
It seems there is a bug (or intentionally introduced feature) in fossil that prevents it searching for the open checkout file (".fslchkout" or "FOSSIL") up to the root directory. That is why in this case you must be in the root directory when you execute commands on this checkout.
Of course all executions of fossil in this case must be with root privileges. Otherwise, even in the root directory you will get "not within checkout" error.
This situation is covered in great detail in the User Guide, which I recommend wholeheartedly.
http://www.fossil-scm.org/schimpf-book/home
In particular, see version 2.0 of the fossilbook.pdf, in section 2, entitled "Single Users", the section starting with:
I have a directory called FOSSIL in which I keep all my repositories, Fossil doesn’t care but it helps me to keep them all in one place so I can back them up.
The first command there shows how to call relative directories:
$ fossil new ../FOSSIL/FossilBook.fossil