2013-06-01 269 views
1

由於標題狀態我正在上傳我的項目到github(https://github.com/siddhartha-ramesh/FilmReview.git),但我被卡在這裏。我不能上傳一個名爲img的目錄給github任何人都可以幫助我如何做到這一點。我沒有使用任何gui。我可以在創建新文件的方式中創建github.com中的新文件夾嗎?上傳圖片文件夾到github

這是什麼,正在發生的事情:

[email protected] ~/Desktop/Untitled Folder $ git remote add origin [email protected]:siddhartha-ramesh/FilmReview.git 
[email protected] ~/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. 
[email protected] ~/Desktop/Untitled Folder $ cd ~ 
[email protected] ~ $ cd .ssh 
[email protected] ~/.ssh $ ssh-keygen -t rsa -C "[email protected]" 
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 
[email protected] ~/.ssh $ cd /home/siddharhta/.ssh 
bash: cd: /home/siddharhta/.ssh: No such file or directory 
[email protected] ~/.ssh $ cd /home/ 
[email protected] /home $ cd * 
[email protected] ~ $ ls 
Desktop Documents Downloads Music Pictures Public Templates Videos 
[email protected] ~ $ cd .. 
[email protected] /home $ ls 
siddhartha 
[email protected] /home $ cd siddhartha/ 
[email protected] ~ $ cd .ssh 
[email protected] ~/.ssh $ ls 
key key.pub known_hosts 
[email protected] ~/.ssh $ cat key 
-----BEGIN RSA PRIVATE KEY----- 
-----END RSA _________________ 
[email protected] ~/.ssh $ ls -a 
. .. key key.pub known_hosts 
[email protected] ~/.ssh $ cat key.pub 
ssh-rsa 
#key here 
[email protected] ~/.ssh $ cd .. 
[email protected] ~ $ ls 
Desktop Documents Downloads Music Pictures Public Templates Videos 
[email protected] ~ $ cd Desktop/ 
[email protected] ~/Desktop $ ls 
Aptana_Studio_3 C_C++ Codes key Untitled Folder WS 
[email protected] ~/Desktop $ cd Untitled\ Folder/ 
[email protected] ~/Desktop/Untitled Folder $ ls 
film_review 
[email protected] ~/Desktop/Untitled Folder $ git remote add origin [email protected]:siddhartha-ramesh/FilmReview.git 
fatal: remote origin already exists. 
[email protected] ~/Desktop/Untitled Folder $ git push origin master 
To [email protected]:siddhartha-ramesh/FilmReview.git 
! [rejected]  master -> master (non-fast-forward) 
error: failed to push some refs to '[email protected]: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. 
+0

你的意思是將它添加到你的項目?圖像文件沒有什麼魔力。不要忘記添加目錄,而不只是其中的文件。 – gmcgath

+0

你能告訴我們,如果上傳過程返回一些錯誤?值得注意的是,圖片_usually_是一個非常大的文件,因此需要一些時間才能完成上傳。 – Michele

回答

2

如果你有你的文件夾與文件在本地回購(克隆你的github回購)(在這種情況下的圖片),所有你需要做的看到GitHub上的文件夾是:

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 

換句話說,您添加該文件夾中的所有文件,並推送它們。

而不是嘗試添加遠程,首先克隆您的GitHub回購,添加本地克隆和推送內容。
先別使用ssh,使用基於HTTPS的一個簡單的網址,以及您的登錄/密碼:

git clone https://[email protected]/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' 
+0

我真的面臨很多麻煩,我做了同樣的事情,沒有任何東西上傳 –

+0

@SwaroopNagendra沒有問題,我編輯了我的答案,一步一步的解決方案。 – VonC

+0

感謝它爲我工作 – user1815823