How to attach file to a GitHub issue? - github

I migrated with a project from Bitbucket to GitHub and I cannot find a way to attach a file to an issue (ex: screenshot, specs, etc).
How to do it?

You upload it somewhere and add the link in a comment. GitHub's Issues is rather primitive and doesn't allow attaching files.
Update: You can post images to GitHub issues now. The easiest way is to copy the image (right click, Copy image) and then paste it into the text box where you describe the issue.
OR
Just drag and drop

As of December 7, 2012, you can attach images by drag/drop or use a file chooser. See https://github.com/blog/1347-issue-attachments for more details.

To attach a file to an issue or pull request conversation, drag and drop it into the comment box.
The maximum size for files is 25MB and the maximum size for images is 10MB.

ZenHub.io Chrome plug-in will enable you to add any type of file to a github issue. It's stored on ZenHub's AWS server instead of github.com. From their website...
GitHub only allows you to upload image files. ZenHub adds the ability
to upload any type of file into issues and comments, transferring
securely to Amazon S3. With this you can really take your workflow to
the next level; try using GitHub for everything! Centralized
collaboration and transparency are awesome.
Update:
As of 11/03/2015 you can now upload these types of files to github without any extension or plug-in: PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, or PDF

As an illustration of the previous answers, see this comment:
I create a repository called catfood http://github.com/blueheadpublishing/catfood/ where I keep misc stuff (like screenshots and other attachments).
That way I can reference them in issues.
See https://github.com/blueheadpublishing/bookshop/issues/10
Some images showing the types of layout templates we want to have generated by templates:
Example One - Three Percentage Columns
Example Two - Two Percentage Columns Left
Example Three - Two Percentage Columns Right
Back in 2009, GitHub expressed the intent to add attachment to issues.
Attachments are something we'd like to add.
That topic wasn't raised since in the GitHub group though...

The format for embedding images into a GitHub comment is:
Format: ![Alt Text](url)
Example: ![GitHub Logo](/images/logo.png)

Use gist.github.com to upload any contents like code, log, html files etc. and share the link.

It's a bit of a kludge but you could create a junk branch, then commit the file to that branch and purge it later.
EDIT: This script may be of use to you:
https://github.com/wereHamster/ghup

I found an easy way to embed images in issues using Skitch. Just set up Skitch sharing and auto-copy the URL to the clipboard. Then paste it in when writing up the issue. I blogged about it here.

One quick/easy hack is to upload your attachment (say PDF or Office doc) to Dropbox, then include the Dropbox URL in the Github issue.
Mildly easier than using S3; many organizations are already using Dropbox; and Dropbox has good support for viewing many documents inline in the browser already.

8 years later (Dec. 2020), you can not only drag and drop images to PR/issues, but also... videos!
And in May 2021, this is now generally available.
Video upload public beta
You can now upload .mp4 and .mov files to issue, pull request, and discussion comments to share reproduction steps, design ideas, and experience details with your team.
The public beta will gradually rollout to all GitHub accounts over the coming week.

OK, here's what I use for screenshots.
http://www.techsmith.com/jing.html
It's free, fast, automatically uploads the image and pastes a URL link to your clipboard which you can Ctrl-V into the GitHub issue instantly.
It was a big sigh of relief when I discovered this :)

If your image is already uploaded to github, then you can attach raw link to issues. For example, if your image's location in github is:
https://github.com/Qlio/someproj/blob/master/assets/image.png
then you can can change blob to raw like this:
https://github.com/Qlio/someproj/raw/master/assets/image.png
and then you can use this link to show image:
![My cool Image](https://github.com/Qlio/someproj/raw/master/assets/image.png)

Related

Is there a way to copy-paste images into Tiki-Wiki pages?

I have a large number of existing MS Word documents I want to import into tiki-wiki, but some of these include images that don't carry over into the editor (including the WYSIWYG editor).
I'm looking for some plugin or setting that would allow me to copy-paste images into the tiki-wiki editor that automatically uploads images to the file gallery and insert the image in place. Converting the documents to HTML code is one solution I have found to retain the images and Word documents, but removes the ability to easily edit the wiki pages.
I have looked and cannot seem to find anything like this. In fact, many members of the wiki community seem to be against such a feature. Has anyone found a plugin or workaround for this issue?
Sorry, that's not a feature in Tiki currently, it would be great if it was (i'm surprised anyone seemed to be against it, we always welcome volunteers and sponsors if you're willing to code or commission it!)
We are planning to migrate to markdown over the next few versions, so maybe add this as a feature request as part of that? The planning page is here https://dev.tiki.org/WYSIWYG-and-Markdown

Upload a dataset to github

I want to upload a dataset to github (with some related stuff like description files and some links) as done in here http://hfed.github.io/ and in here http://iawe.github.io/
Does anyone know how this can be done?
Those are websites, hosted by github. Check this out: https://pages.github.com/

Can I upload a document to an Issue in github?

I have a document that I would like to reference from a github issue, but there is not a way to upload it. Any ideas?
You can't currently attach files to github issues.
Update:
As of 2012-12-07, images can be attached to issues via drag-and-drop.
Just drag the image into the text field for the issue.
ZenHub.io Chrome plug-in will enable you to add any type of file to a github issue. It's stored on their server instead of github.com. From their website...
GitHub only allows you to upload image files. ZenHub adds the ability
to upload any type of file into issues and comments, transferring
securely to Amazon S3. With this you can really take your workflow to
the next level; try using GitHub for everything! Centralized
collaboration and transparency are awesome.
Update:
As of 11/03/2015 you can now upload these types of files to github without any extension or plug-in: PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, or PDF
If you have an account in github, then you can upload your document in Github's own Gist service: gist.github.com
After add the link in a comment of issue.
I think this will help you
For more details, see this bug : How to attach file to a github issue?

How to add screenshot to READMEs in github repository?

Is it possible to place a screenshot in README file in a GitHub repository? What's the syntax?
If you use Markdown (README.md):
Provided that you have the image in your repo, you can use a relative URL:
![Alt text](/relative/path/to/img.jpg?raw=true "Optional Title")
If you need to embed an image that's hosted elsewhere, you can use a full URL
![Alt text](http://full/path/to/img.jpg "Optional title")
GitHub recommend that you use relative links with the ?raw=true parameter to ensure forked repos point correctly.
The raw=true parameter is there in order to ensure the image you link to, will be rendered as is. That means that only the image will be linked to, not the whole GitHub interface for that respective file. See this comment for more details.
Check out an example: https://raw.github.com/altercation/solarized/master/README.md
If you use SVGs then you'll need to set the sanitize attribute to true as well: ?raw=true&sanitize=true. (Thanks #EliSherer)
Also, the documentation on relative links in README files: https://help.github.com/articles/relative-links-in-readmes
And of course the markdown docs: http://daringfireball.net/projects/markdown/syntax
Additionally, if you create a new branch screenshots to store the images you can avoid them being in the master working tree
You can then embed them using:
![Alt text](/../<branch name>/path/to/image.png?raw=true "Optional Title")
Even though there is already an accepted answer I would like to add another way to upload images to readme on GitHub.
You need to create issue in your repo
Drag and drop in the comment area your image
After link for the image is generated insert it to your readme
More details you can find here
I found that the path to the image in my repo did not suffice, I had to link to the image on the raw.github.com subdomain.
URL format https://raw.github.com/{USERNAME}/{REPOSITORY}/{BRANCH}/{PATH}
Markdown example ![Settings Window](https://raw.github.com/ryanmaxwell/iArrived/master/Screenshots/Settings.png)
JUNE 3, 2020 : WORKING ANSWER-
Upload your image to postimage.org
Copy Github-Markdown-Url after uploading Image
Insert in your ReadMe
One line below should be what you looking for
if your file is in repository
![ScreenShot](https://raw.github.com/{username}/{repository}/{branch}/{path})
if your file is in other external url
![ScreenShot](https://{url})
The markdown syntax for displaying images is indeed:
![image](https://{url})
BUT: How to provide the url ?
You probably do not want to clutter your repo with screenshots, they have nothing to do with code
you might not want either to deal with the hassle of making your image available on the web... (upload it to a server... ).
So... you can use this awesome trick to make github host your image file. TDLR:
create an issue on the issue list of your repo
drag and drop your screenshot on this issue
copy the markdown code that github has just created for you to display your image
paste it on your readme (or wherever you want)
http://solutionoptimist.com/2013/12/28/awesome-github-tricks/
Much simpler than adding URL
Just upload an image to the same repository,
like:
![Screenshot](screenshot.png)
add this to README
<div align="center">
<img src="/screenshots/screen1.jpg" width="400px"</img>
</div>
From March 2021, this is now supported:
Attaching files to markdown files
You can now attach files, including images, to markdown files while you're editing them in the web.
This works just like file attachments in issues and pull requests and supports the same file types.
Just drag and drag, click and select, or paste.
Note: If you add an image to a markdown file, anyone can view the anonymized image URL without authentication, even if the markdown file is in a private repository.
To keep images private, serve them from a private network or server that requires authentication.
For more information on anonymized URLs see "About anonymized image URLs".
Markdown: ![Screenshot](http://url/to/img.png)
Create an issue regarding adding images
Add the image by drag and drop or by file chooser
Then copy image source
Now add ![Screenshot](http://url/to/img.png) to your README.md file
Done!
Alternatively you can use some image hosting site like imgur and get it's url and add it in your README.md file or you can use some static file hosting too.
Sample issue
Method 1->Markdown way
![Alt Text](https://raw.github.com/{USERNAME}/{REPOSITORY}/{BRANCH}/{PATH})
Method 2->HTML way
<img src="https://link(format same as above)" width="100" height="100"/>
or
<img src="https://link" style=" width:100px ; height:100px " />
Note-> If you don't want to style your image i.e resize remove the style part
For me, the relative path worked out very well.
How I did this:
In my current md file where I wanted to use a picture from another directory, I used a relative path like this - consider following points.
md file loc: base dir -> _post -> current_file.md
& picture file loc which I wanted to use: base dir -> _asset -> picture_to_use.jpeg
What the statement I used was on current_file.md file:
![your-pic-caption-name](../_asset/picture_to_use.jpeg)
Note - before this, I was using direct _asset but Ideally, it so starts from ../_asset/and-so-no
reference - https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-readmes
Add ![ScreenShot](screenshot.png) in the readme markdown as mentioned by many above. Replace screenshot.png with the name of the image you uploaded in your repository.
But here is a newbie tip when you upload the image (as I made this mistake myself):
ensure that your image name does not contain spaces. My original image was saved as "Screenshot day month year id.png". If you don't change the name to something like contentofimage.png, it won't appear as an image in your readme file.
I googled a few similar questions and did not see any answers with my problem and its quite simple/easy solution.
Google Cloud Storage - a slightly different approach to images in READMEs
Here goes: like the OP, I wanted an image in my Github README, and, knowing the Markdown syntax for doing so, typed it in:
![My Image](https://storage.cloud.google.com/${MY_BUCKET}/${MY_IMAGE}
You need to complete the actual substitutions above (e.g. MY_IMAGE=image.jpg) for this to work.
But, wait...failure--there's no actual rendered photo! And the link is exactly as given by Google Storage!
Github camo - Anonymous Images
Github hosts your images anonymously, yay! However, this presents an issue for Google storage assets. You need to get the generated url from your Google Cloud Console.
I'm sure there's a smoother way, however, simply visit your given URL endpoint and copy the long URL. Details:
Instructions
Visit your storage console: https://console.cloud.google.com/storage/browser/${MY_BUCKET}?project=${MY_PROJECT}
Click on the image you'd like to display in Github (this brings up the "Object Details" page)
Copy pasta that URL (the one starting with https not gs) into a new browser tab/window
Copy pasta the new generated URL -- it should be longer -- from your new browser tab/window into your Github README file
Hopefully this helps speed up and clarify this issue for anyone else.
Please fallow this four step,
this worked for me
1-Create a new issue on GitHub.
2-Drag-and-drop an image onto the comment field or upload a photo.
3-Wait for the upload process to finish.
4-Copy the URL and use it in your Markdown files on GitHub (use that generated URL in your repository's readme).
First, create a directory(folder) in the root of your local repo that will contain the screenshots you want added. Let’s call the name of this directory screenshots. Place the images (JPEG, PNG, GIF,` etc) you want to add into this directory.
Android Studio Workspace Screenshot
Secondly, you need to add a link to each image into your README. So, if I have images named 1_ArtistsActivity.png and 2_AlbumsActivity.png in my screenshots directory, I will add their links like so:
<img src="screenshots/1_ArtistsActivity.png" height="400" alt="Screenshot"/> <img src=“screenshots/2_AlbumsActivity.png" height="400" alt="Screenshot"/>
If you want each screenshot on a separate line, write their links on separate lines. However, it’s better if you write all the links in one line, separated by space only. It might actually not look too good but by doing so GitHub automatically arranges them for you.
Finally, commit your changes and push it!
To me the best way is -
Create an new issue with that repository on github and then upload the file in gif format.To convert video files into gif format you can use this website http://www.online-convert.com/
Submit the newly created issue.
Copy the address of the uploaded file
Finally in your README file put ![demo](COPIED ADDRESS)
Hope this will help .
Add image in repository from upload file option then in README file
![Alt text]("enter image url of repositoryhere")
Create a New issue by clicking on the green button in the upper right corner. Take a screenshot of whatever you need and paste it into the issue message (CMD+V on Mac or CTR+V on Windows).
My image had space in the name, e.g. Pasted image 20221006123035.png, and that was causing a problem from me, and I lost some time fixing it. If someone has the same issue, then here are the steps
I uploaded the image via upload option
Then clicked on the image in the file browsing UI of the website.
The image is opened in the browser. From the browser's URL I copied the url of the image. You can copy the whole path, or relative to your .md file
Now insert that link to the .md file like ![overview](Pasted%20image%2020221006123035.png)
With the images located in /screen-shots directory. The outer <div> allows the images to be positioned. Padding is achieved using <img width="desired-padding" height="0">.
<div align="center">
<img width="45%" src="screen-shots/about.PNG" alt="About screen" title="About screen"</img>
<img height="0" width="8px">
<img width="45%" src="screen-shots/list.PNG" alt="List screen" title="List screen"></img>
</div>

Embedding images inside a GitHub wiki (gollum) repository?

The Github wikis are backed by a separate git repository then the main project repository.
This post by the Github team makes it sound like you should be able to link to images stored in the wiki repository inside the wiki markup.
Images and Folders
You can now reference images hosted inside the Git repository.
I've checked out my wiki's repository and pushed a resource folder and an image into it. My question is, how do I go about using this image?
Is this even possible or have I misunderstood something?
For viewers wishing to view images on a github wiki I've found the following method to work:
Go to the "Git Access" tab inside the wiki page of your repository and retrieve the SSH path which should be some thing like: git#github.com:USER/REPO.wiki.git where USER is your account name and REPO is the repository name.
On your local machine use whichever Git command line tool you wish to cd into your local directory of choice and get the repository via
git clone git#github.com:USER/REPO.wiki.git
Now within this repository create an image directory, I'll call it "images" and put whatever images you want into the directory
And then push your wiki git directory to github
You will not be able to physically see the images in say the "Pages" tab, but if you simply reference the images in a local link you should be able to see them. Example with Markdown below:
![Alt attribute text Here](images/YOURIMAGE.ext)
You may also embed the image as a link itself by wrapping it further like so:
[![Alt attribute text Here](images/YOURIMAGE.ext)](http://Yoursite.com)
You can also add subdirectories within your local copy to help organize the wiki since the "pages" tab simply lists them out. Keep in mind, however, that even when the new directory is pushed the "pages" tab doesn't list the directory.
To use relative paths do:
[[foo.jpg]]
For more info, see the demo wiki's page on images.
None of answers seem to work when adding an image in readme.md. I've got a solution though:
If the URL of the image is:
https://github.com/Username/Repository-Name/blob/master/Directory-Inside-Repository/image.png
Replacing blob with raw gives you the URL of the raw image:
https://github.com/Username/Repository-Name/raw/master/Directory-Inside-Repository/image.png
Now, you'd embed the image using normal markdown:
![Image Alt](https://github.com/Username/Repository-Name/raw/master/Directory-Inside-Repository/image.png)
UPDATE: As of now, GitHub also serves raw images from a different sub-domain raw.github.com. So, you can also use:
https://raw.github.com/Username/Repository-Name/master/Directory-Inside-Repository/image.png
EXAMPLE: https://raw.github.com/Automattic/liveblog/master/screenshot-1.png
Relative path work for me like this:
home page of the wiki:
![text](wiki/images/someimage.png)
sub page of the wiki:
![text](images/someimage.png)
Note that when doing a preview the image will not show, I had save it.
If you want to quickly upload an image with drag/drop, you can perform the following (albeit hackish):
Create a dummy issue; drag & drop your image there; copy/paste the uploaded markdown image code to your wiki;
After you create the issue once, you can use it any number of times to do this.
Hope this helps anyone looking for a quick fix, without needing to have the image reside in the repo.
Here is a practical way to do it:
Go to any issue on github
In the comment section you can attach files, just drag/drop, select or paste your image
Copy the code/link displayed in the textarea
Paste it in the wiki
Profit !
You don't even have to create or modify any issue compared to #tiby solution !
Figured it out.
The url is formatted as follows
https://raw.github.com/wiki/username/project/pathtoimage/imagename.extension
pathtoimage is optional
James' URL format did not work for me, perhaps it has been changed. I have used:
https://github.com/username/project/wiki/pathtoimage/image.extension
Where pathtoimage is optional.
Finally got the images into repository using the method described by nerdwin and got them to display in the wiki using ![test](test.jpg)
The following markdown will reference an image in your GitHub repo from within your corresponding GitHub wiki
![My Alt Text](../blob/master/Path/ToAsset/In/Repo.png?raw=true)
The above example assumes that you have the following file structure in your repo
Path
ToAssets
In
Repo.png
For a real world example, if I wanted to reference this image in github from the corresponding wiki, I'd use this markdown
![Azure App Settings](../blob/master/TrelloWorld/TrelloWorld.Server/Assets/Azure_AppSettings.png?raw=true)
Caveats
Case matters
If you are on the special Home page of the wiki, you do not need to go up a level with the ../ In my example above, the correct link would be
For Home Page:
![Azure App Settings](blob/master/TrelloWorld/TrelloWorld.Server/Assets/Azure_AppSettings.png?raw=true)
Use the relative path
the Wiki is located at [repositoryname]/wiki
The files in the repository are located at [repositoryname]/raw/master/[file path in repository]
So just use the relative path: ../raw/master/[file path in repository]
I put both images and PDFs in my wikis. I clone the wiki and add an images and a files directory, then use the following markdown to embed image links and add file links:
Images:
[[/images/path/to/image.ext|ALT TEXT]]
The leading slash isn't necessary if your wiki pages are all at the root level, but I use subdirectories and an absolute path resolves correctly and keeps things simple.
Files:
[link text](files/path/to/file.ext "ALT TEXT")
Note, no leading slash for the wiki files path to resolve correctly as a link in this format.
I documented this with more detail in a GitHub gist
Since Feb. 2022, you can simply drag and drop, select or paste the file.
That will upload the image to your Wiki pages, and store it in https://user-images.githubusercontent.com
To embed an external image thumbnail, use the following,
![Image](<external link to the image>)
The comment from #Drew Noakes to the original question did it for me:
The syntax for the image I wanted to be displayed:
[[/images/imageName.png]]
This image was only displayed when renaming:
wikiPage.md --> wikiPage.wiki
The following folder structure was used in the wiki repository:
repository.wiki
|--wikiPage.wiki
|--images
|--imageName.png
BUT:
The syntax in .wiki differs from .md files.
Many of the answers didn't work for me, here's what finally worked:
![](../raw/master/Images/ImportantImage.png)
Using the "Markdown" editor mode and a sub-page such as:
https://github.com/project/repo/wiki/MyPage