上传文件夹与图像到github [英] Uploading Folder with images to github

查看:181
本文介绍了上传文件夹与图像到github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所述,我正在将我的项目上传到github( https://github.com/ siddhartha-ramesh / FilmReview.git ),但我被困在这里。我不能上传一个名为img的目录给github任何人都可以帮助我如何做到这一点。我没有使用任何gui。我可以在github.com中创建一个新文件夹,只要我可以创建新文件?

这就是发生了什么:

  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
'github.com(204.232.175.90)'的真实性无法建立。
RSA密钥指纹是16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48。
您确定要继续连接(是/否)吗? y
请输入'yes'或'no':yes
警告:将'github.com,204.232.175.90'(RSA)永久添加到已知主机列表中。
权限被拒绝(publickey)。
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限
并存在存储库。
siddhartha @ siddhartha-Inspiron-545s〜/桌面/无标题文件夹$ cd〜
siddhartha @ siddhartha-Inspiron-545s〜$ cd .ssh
siddhartha @ siddhartha-Inspiron-545s〜/。 ssh $ ssh-keygen -t rsa -Csiddhartharamesh@gmail.com
生成公钥/私钥rsa密钥对。
输入保存密钥的文件(/home/siddhartha/.ssh/id_rsa):key
输入密码(空密码):
再输入一次密码:
您的身份已被保存在密钥中。
您的公钥已保存在key.pub中。
关键指纹是:
#key这里
siddhartha @ siddhartha-Inspiron-545s〜/ .ssh $ cd /home/siddharhta/.ssh
bash:cd:/ home /siddharhta/.ssh:没有这样的文件或目录
siddhartha @ siddhartha-Inspiron-545s〜/ .ssh $ cd / home /
siddhartha @ siddhartha-Inspiron-545s / home $ cd *
siddhartha @ siddhartha-Inspiron-545s〜$ ls
桌面文档下载音乐图片公共模板视频
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- ----
-----完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
桌面文档下载音乐图片公共模板视频
siddhartha @ siddhartha-Inspiron-545s〜$ cd桌面/
siddhartha @ siddhartha-Inspiron-545s〜/ Desktop $ ls
Aptana_Studio_3 C_C ++代码键无标题文件夹WS
siddhartha @ siddhartha-Inspiron-545s〜/ Desktop $ cd无标题\文件夹/
siddhartha @ siddhartha-Inspiron-545s〜/桌面/无标题文件夹$ ls
film_review
siddhartha @ siddhartha-Inspiron-545s〜/桌面/无标题文件夹$ git remote add origin git @ github。 com:siddhartha-ramesh / FilmReview.git
致命的:远程原点已经存在。
siddhartha @ siddhartha-Inspiron-545s〜/桌面/无标题文件夹$ git push origin master
至git@github.com:siddhartha-ramesh / FilmReview.git
! [被拒绝] master - >主(非快进)
错误:无法将某些参考文献推送到'git@github.com:siddhartha-ramesh / FilmReview.git'
提示:更新被拒绝,因为您当前的提示分支在
提示后面:它的远程对手。合并远程更改(例如'git pull')
提示:再次按下之前。
提示:有关详细信息,请参阅'git push --help'中的'关于快速转发的注意事项'。


解决方案

如果您的文件夹中包含您的文件你需要做的就是在GitHub上查看该文件夹:

  cd / path / to / that /文件夹
git add。
git commit添加带图片的文件夹
git push
#或者,如果这是您的第一次推送:
git push -u原点大师

换句话说,您将该文件夹中的所有文件添加到该文件夹​​中,然后将其推入。



不要尝试添加远程设备,首先克隆您的GitHub repo,在本地克隆中添加内容并推送。

不要先使用ssh,使用基于https的更简单的url,并且您的登录/密码:

  git克隆https://siddhartha-ramesh@github.com/siddhartha-ramesh/FilmReview 
cd FilmReview
git config user.name siddhartha-ramesh
git config user.email(您在GitHub上使用的电子邮件地址)
#添加您的文件
git add。
git commit -m添加文件夹
git push -u原始大师
#下一个push可以简单地'git push'


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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆